Except that the parens () will be used for grouping and capturing by the regex, and so won't match the literals in the string;
perl -e '$s = q|b(s)|; print "without quotemeta" if $s =~ /$s/; print + "with quotemeta" if $s =~ /\Q$s\E/;' with quotemeta
In reply to Re: Re: Re: Matching brackets in Regular Expression
by qq
in thread Matching brackets in Regular Expression
by Levan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |