in reply to Interesting Regex Behavior
In the first pattern match because you're using the * quantifier on the first set of parens nothing is matched be cause it's a lazy quantifier and $1 gets nothing, and $2 is undefined since it isn't even executed.
In the second pattern match the * goes to the end of the string, matches 'b', backtracks to the 'a', and the goes forward to the 'b', which respectively explains the $DIGITs.
I suspect both guesses are pretty close to the truth, but I couldn't say for sure not being at one with the perl regex engine and all ;)
HTH
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Interesting Regex Behavior
by japhy (Canon) on Nov 22, 2002 at 15:43 UTC |