regex question?
| From: | Shawn McKenzie | Date: | Mon, 24 Feb 2003 07:47:03 +0000 |
| Subject: | regex question? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-136852@lists.php.net to get a copy of this message | ||
I'm using the following to try and replace urls in my html output:
$newhrefs = preg_replace("/script.php\?(.*)=(.*)&(.*)=(.*)&(.*)=(.*)/",
"script-$1-$2-$3-$4-$5-$6.html", $hrefs);
This works fine as long as there are exactly 3 var=val pairs... not 1 or 2
or 4 or more...
How can I write my expression to match 1 or more pairs??? For example:
script.php?var=val
script.php?var=val&var2=val2
script.php?var=val&var2=val2&var3=val3
etc...etc...etc...
TIA,
Shawn