|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re^2: How do I avoid double substitution when replacing many patterns?by bart (Canon) |
| on Jan 21, 2007 at 07:51 UTC ( #595736=note: print w/ replies, xml ) | Need Help?? |
|
Replace $1 ||$2 with $+. That'll contain the value of the last capture that actually matched. See perlvar: The text matched by the last bracket of the last successful search pattern. This is useful if you don't know which one of a set of alternative patterns matched. p.s. Originally I mistakingly had posted this as a followup to Re^2: How do I avoid double substitution when replacing many patterns?, now its sibling.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||