$orig='aaa([\+\-]{1})bbb'; $qre="\\Q([\\+\\-]{\\E\\d\\Q})\\E"; $bre='\(\[\\\\\+\\\-\]\{\d\}\)'; $str=$orig; $str =~ s!\Q([\+\-]{\E\d\Q})\E!!; print "Replace against literal quoted: $str\n"; $str=$orig; $str =~ s!\(\[\\\+\\\-\]\{\d\}\)!!; print "Replace against literal bslashed: $str\n"; $str=$orig; $str =~ s!$qre!!; print "Replace against variable quoted => $qre <=: $str\n"; $str=$orig; $str =~ s!$bre!!; print "Replace against variable bslashed => $bre <=: $str\n";