in reply to Re: perl 5.10 bug or not?
in thread perl 5.10 bug or not?
"so the second match would never occur, even if the code compiled because the first match would have swallowed everying in your (then-current) line of data."
Not so!
use v5.10; my $email = 'foo <bar>'; $email =~ /(.*) (<.*>)/; say "1='$1' 2='$2'";
Greedy matches don't automatically swallow everything. A quote from perlre, my emphasis:
"By default, a quantified subpattern is "greedy", that is, it will match as many times as possible (given a particular starting location) while still allowing the rest of the pattern to match."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl 5.10 bug or not?
by ww (Archbishop) on Aug 16, 2013 at 23:57 UTC | |
by AnomalousMonk (Archbishop) on Aug 17, 2013 at 06:55 UTC | |
by sotona (Scribe) on Aug 20, 2013 at 15:28 UTC | |
by Corion (Patriarch) on Aug 20, 2013 at 15:58 UTC |