in reply to Calling a function in regex substitution

Using functions can be done in regexps, but easier in this case is
$str=~s/(iteration)(.*)/<B> /U$1/E$2 <\/B>/g;
See documentation on regexps.

Replies are listed 'Best First'.
Re^2: Calling a function in regex substitution
by bart (Canon) on Sep 11, 2007 at 09:55 UTC
    $str=~s/(iteration)(.*)/<B> /U$1/E$2 <\/B>/g;
    It is recommendable to test your code before posting it here. Your snippet produces a syntax error, and you need to use backslashes, not forward slashes.