Re: regex question?
| From: | Shawn McKenzie | Date: | Mon, 24 Feb 2003 14:45:39 +0000 |
| Subject: | Re: regex question? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-136907@lists.php.net to get a copy of this message | ||
Anyone? please?
Thanks!
Shawn
"Shawn McKenzie" <nospam@mckenzies.net> wrote in message
news:20030224074647.13124.qmail@pb1.pair.com...
> 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
>
>