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/;In reply to Re: Specific substitution in regular expressions
by jonadab
in thread Specific substitution in regular expressions
by cstrong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |