472,127 Members | 1,505 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

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 3006
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.