469,647 Members | 1,803 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

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?
Sep 28 '05 #1
1 2926
What's your current code look like? I have a few ideas...
Oct 5 '05 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

20 posts views Thread by RobG | last post: by
13 posts views Thread by Phat G5 (G3) | last post: by
7 posts views Thread by Csaba Gabor | last post: by
8 posts views Thread by reflex | last post: by
3 posts views Thread by yoni | last post: by
2 posts views Thread by X l e c t r i c | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.