|
|
| Perl-Sensitive Sunglasses | |
| PerlMonks |
Re: Specific substitution in regular expressionsby jonadab (Parson) |
| on Sep 17, 2008 at 10:20 UTC ( #711951=note: print w/ replies, xml ) | Need Help?? |
|
Lookbehind and lookahead will work in the specific example you give, but the more general solution, which will still work if the surrounding stuff can vary in width, is to capture the surrounding stuff and substitute it back: $line =~ s/(12345)(99)(1234599)/$1$replace$3/;--
We're working on a six-year set of freely redistributable Vacation Bible School materials.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||