Re: Another regular expression
| From: | Sebastian Delmont | Date: | Tue, 28 Nov 2000 20:44:16 +0000 |
| Subject: | Re: Another regular expression | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27674@lists.php.net to get a copy of this message | ||
Try this:
\[link:([^\|])+)\|([^\]])+]
That forces the "inner match" not to extend the "closing mark"...
There's also a regexp option that forces the match to be "as short as
possible" instead of the default of "match as much as possible" that will
solve your problem too...
"rodrigo" <rodrigo@shreve.net> wrote in message
news:3A243B9B.638AD79B@shreve.net...
> Hello again. I am still having trouble with the following regular
> expression:
>
> \[link:(.+)\|(.+)\]
>
> this matches the first occurrence of a string like
> "[link:http://www.mlb.com|MLB]" without problems. But
> if there are more
> than one ocurrences it behaves unexpectedly.
>
> I think this has to do with looping. How do you loop in a regex?
>
> --
> ************************************
> Ivan R. Quintero E.* (507)228-3477
> Aptdo 1263 * (507)228-9105
> Balboa, Ancon *
> Republic of Panama *
> ************************************
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>