Examining its output:$orig='aaa([\+\-]{1})bbb'; $res = '([\\+\\-]{'; $qres = '\\Q$res\\E'; $str=$orig; $str =~ s!\Q$res\E!!; print "Replace against variable quoted => $res <=: $str\n"; $str=$orig; $str =~ s!$qres!!; print "Replace against variable quoted => $qres <=: $str\n";
I notice that placing special metacharacters inside your variable doesn't make them 'effective'. However, when they are outside of the variable, they get 'noticed' by the regular expression parser. So, could it be the answer to your inquiry? ;-)Replace against variable quoted => ([\+\-]{ <=: aaa1})bbb Replace against variable quoted => \Q$res\E <=: aaa([\+\-]{1})bbb
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}
In reply to Re: Regex bug or head made of solid bone?
by vladb
in thread Regex bug or head made of solid bone?
by alien_life_form
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |