[thelist] Regular Expression Needed

Joshua Olson joshua at alphashop.net
Sat Dec 8 14:16:56 CST 2001


I'm looking for a replacement regular expression that performs the following
task:

Given a valid URL, I want to:

1) update a parameter in the query string to a new value
or
2) append the new value to the query string

Some examples:

URL: www.mydomain.com/?page=1
Values: "page" and "2"
Result URL: www.mydomain.com/?page=2

URL: www.mydomain.com/?foo=bar
Values: "page" and "2"
Result URL: www.mydomain.com/?foo=bar&page=2

etc.

Can this be done with one single RegEx?

TIA,
-joshua





More information about the thelist mailing list