in reply to Re^2: Regex is eating up whitespace
in thread Regex is eating up whitespace
You should use $1 instead of \1 in the substitution. < and > are not magical in regexen and, apart from $, there are no magical characters in the substitution string in any case - you do not need to escape < and >. Perl allows you to use different delimiters for regexes which can often make the regex much easier to read. Consider:
$text =~ s!(\bS\.(?=\s))!<$1=initial>!g;
|
|---|