Good question, I think many are confused.
It's important to understand that empty matches exist and that e* means e{0}|e+ ( or something like e{0,32766} ° ).
So you are actually matching e{0} before all!
Printing out the match position of a capture group via @+ helps demonstrating it
DB<1> $_ = "This is a teeeext for testting"; DB<2> ;/(?<char>e*)/ and print "'$+{char}' is matched pattern at p +os $+[0]\n"; '' is matched pattern at pos 0 DB<3> ;/(?<char>e{0})/ and print "'$+{char}' is matched pattern at + pos $+[0]\n"; '' is matched pattern at pos 0 DB<4> ;/(?<char>e+)/ and print "'$+{char}' is matched pattern at p +os $+[0]\n"; 'eeee' is matched pattern at pos 15 DB<5> ;/(?<char>e{1,32766})/ and print "'$+{char}' is matched patt +ern at pos $+[0]\n"; 'eeee' is matched pattern at pos 15 DB<6>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
°) yes there is an maximal upper bound in range quantifiers, which I expected to be around 2**16, so it's an incomplete analogy
In reply to Re^3: Greedy modifier found to be working non-greedy in a named group
by LanX
in thread Greedy modifier found to be working non-greedy in a named group
by rkabhi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |