On 07/28/2006 03:01 PM, Jeremy Kister wrote:
perldoc -q quote talks about \Q before a regex to escape special characters.

how do you use \Q when you want to anchor the regex with a dollar sign ?


my $string = my $regex = "foo";
print "match\n" if($string =~ /^\Q${regex}$/);




\E enables normal regex metacharacter usage:

/^\Qmystring\E$/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to