|Syntactic Confectionery Delight|
Regex capture consumed by non-capturing matchby ribasushi (Monk)
|on Jul 19, 2007 at 20:36 UTC||Need Help??|
ribasushi has asked for the
wisdom of the Perl Monks concerning the following question:
Hello honorable Monks, Today I uncovered a very subtle bug in one of my programs, and although I fixed it I have no idea what is actually going on. Here is an example program that demonstrates what happens:
What is the difference between the two regexes? Why does only trim_end() destroy $2? I solved my problem by doing:
but I still would like to know what causes this.
Thank you in advance.