in reply to Dynamic regex assertions, capturing groups, and parsers: joy and terror
I find this quite confusing as well.
Update: No this makes perfect sense. Thanks to dio for straightening me out.
$rx = qr{ (.) (??{ print $1 }) }x; print "!" if "japhy" =~ $rx; __END__ japhy
How does $1 end up being 'japhy' with this re? Interestingly, changing it to
$rx = qr{ (.) (??{ print $1; '' }) }x; print "!" if "japhy" =~ $rx; __END__ j!
makes things work out properly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dynamic regex assertions, capturing groups, and parsers: joy and terror
by diotalevi (Canon) on Oct 03, 2005 at 23:09 UTC | |
by demerphq (Chancellor) on Oct 04, 2005 at 09:13 UTC |