RegExp replace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • eysteinbye
    New Member
    • Sep 2005
    • 1

    RegExp replace

    I have a problem with my RegExp.

    I need to replace some URLs with other URLs. I am using a URL-rewrite filter). The problem is that when the RegExp match just parts of the string, it does a replace anyway. I want it to only replace if it matches the entire targetstring.

    Target strings might be like this:

    1: /news/public.asp?myid =1234
    2: /justadirectory
    3: /justadirectory/
    4: /justadirectory/something
    5: /justafile.html
    6: /directorywhith. dot
    7: /directorywhith. dot/

    If I make a RegExp like this:

    (/[a-z]{3,20}/?)
    It matches targetstring 2 and 3, but it also matches parts of the other strings.

    Is there any why to say that it needs to match the entire string to do the replace, otherwise don’t replace the parts that you do math?
  • octoberdan
    New Member
    • Sep 2005
    • 18

    #2
    What's your current code look like? I have a few ideas...

    Comment

    Working...