ultranerds has asked for the wisdom of the Perl Monks concerning the following question:
Now, I have this regex:[url]http://www.test.com[/url] [img]http://www.site.com/image.jpg[/img] [url http://www.test.com]name of link[/url] [citation]some quote here[/quote]
..which is meant to capture the / (if it exists, after the [, and assign to $1), and then also capture to tag name itself to $2)while ($_[0] =~ /\[(\/?)(lien|url|citation|img).+?\]/sg) { print "GOT: $1 and $2 \n"; }
..it works, but obviously doesn't pick up stuff like:while ($_[0] =~ /\[\/?(lien|url|citation|img)\]/sg) { print "BLA: $1 \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex question
by moritz (Cardinal) on Sep 22, 2011 at 15:18 UTC | |
|
Re: Regex question
by Anonymous Monk on Sep 22, 2011 at 15:12 UTC | |
by ultranerds (Hermit) on Sep 22, 2011 at 15:21 UTC |