Nov 18, 2015, 7:37 AM
Post #1 of 2
GOT IT WORKING. Problem solved.
Regex substitute with capture not changing string
Basically I'm trying to change a string in this format: '^1 <#cn1>' to this format: '[^1]'. Here's a tiny program for an example.
I thought I fixed it but my resulting string in $in, has backslashes, which I do not want. I'll test further.
$in='blah blah blah.^1 <#fn1> blah blah blah';
# Convert '^1 <#fn1>' to '[^1]'.
if ($in=~m/\^(\d+) <#fn\d+>/)
# Use \Q and \E if old string might contain backslashable ctrs.
print "\$in now is: $in\n";
Did I miss escaping some characters somewhere? Anyone have any idea how to make this work?
(This post was edited by bulrush on Nov 18, 2015, 11:06 AM)