in reply to Regular expression substitution question
$output =~ s/\x7E(?=.)/\x7D\x5E/g;
It could also be expressed without the zero-width assertion like this:
$output =~ s/\x7E\G(.)/\x7D\x5E$1/g;
But the latter will probably run slower because it requires capturing parens.
Update: Use the solutions with lookahead (Enlil's, duff's, or mine); they work, whereas the method that I've "crossed out" skips occurrences of the tilde if they're contiguous.
Dave
|
|---|