Can I use a wildcard in this Reg Expression?

Posted on 2011-10-10
Last Modified: 2012-05-12

I have this, it's getting an id out of a file in a directory.

  <cfset theNum=ReReplaceNoCase(cs_uri_stem,".+/Floorplan(\d+).+","\1") >

But I want to know if I can just use a wildcard/asterisk in case there is some other chars in front of the word Floorplan...

Does this work? How would I do it?

  <cfset theNum=ReReplaceNoCase(cs_uri_stem,".+/*Floorplan(\d+).+","\1") >
Question by:monosyth

    Author Comment


    Real life example is:

    files it could be looking at might be:


    I'm just trying to get the ID before the jpg and after the word Floorplan. Thanks!!
    LVL 34

    Accepted Solution

    Close - try this:
      <cfset theNum=ReReplaceNoCase(cs_uri_stem,".+/[^/]*Floorplan(\d+).+","\1") >
    LVL 34

    Expert Comment

    by:Terry Woods
    Perhaps simpler:
      <cfset theNum=ReReplaceNoCase(cs_uri_stem,"Floorplan(\d+)\D","\1") >
    LVL 34

    Expert Comment

    by:Terry Woods
    Sorry - that last suggestion is not suitable for a replace. My first suggestion should be fine I think.
    LVL 34

    Expert Comment

    by:Terry Woods
    Is there any chance the image could be more than one directory deep? If so, it would help to know whether the value in cs_uri_stem might contain anything before the directory name that you don't want replaced. If not, then this would allow anything at all before "Floorplan":
      <cfset theNum=ReReplaceNoCase(cs_uri_stem,".*Floorplan(\d+).+","\1") >

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now