Do you know where your variables are? | |
PerlMonks |
Re: You won't believe what this regular expression does!by LanX (Saint) |
on Feb 25, 2021 at 13:01 UTC ( [id://11128780]=note: print w/replies, xml ) | Need Help?? |
Lets dissect this into smaller problems.
SimplificationI tried to simplify the case to avoid misunderstandings
Surprise: the o is replaced twice.
Explanation so farYou and Hauke already explained that
(And I agree that the referenced perlre#Repeated-Patterns-Matching-a-Zero-length-Substring needs a rewrite)
DisappointmentsNow, why is it surprising? I think your case is that $ in combination with the /m modifier should act differently. Correct?
WorkaroundsHere a guess for the last question
MetaQuestion @all: Is the problem better understood now? :)
Cheers Rolf
editadded more code
updateadded headlines for structuring °) because empty patterns are always matching compare
In Section
Seekers of Perl Wisdom
|
|