![]() |
|
more useful options | |
PerlMonks |
Re^4: Strange Occurrence in Substitution Statementby LanX (Saint) |
on May 06, 2025 at 21:08 UTC ( [id://11164969]=note: print w/replies, xml ) | Need Help?? |
I think it's simpler, the pattern isn't empty, because (?:...) is always part of the pattern. Meta characters count too. This idiom is meant to be used as s//something/ in complicated parsing, kind of inherited from sed/awk IIRC. You should also be aware that a genuinely empty pattern IS always matching. In your case the replacement is just invisible because empty. So I'd rather prefer to make this explicit and self documenting
Nowadays I doubt there are more than a fraction of a percent of programmers knowing/using this feature. I'd really like to see a Perl version/feature to switch it off by default.
Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|