P is for Practical | |
PerlMonks |
Re: regular expression search and replaceby hippo (Bishop) |
on Nov 18, 2014 at 17:55 UTC ( [id://1107608]=note: print w/replies, xml ) | Need Help?? |
Your replacement has to be something tangible, not a pattern. However you can use the /e modifier to execute code in the replacement. Combining this with a capture group works like this:
Giving this output:
Be sure to have a good read of perlre as regexes and the s/// function are bedrocks of Perl. HTH, Hippo
In Section
Seekers of Perl Wisdom
|
|