in reply to Normal regexes stop working

I think its because regular expressions have syntax of their own, and it seems you want to use eq
die if 'stu\d' =~ /stu\d/; die if 'stu\d' =~ 'stu\d'; die if 'stu\d' =~ /\Qstu\d\E/; __END__ Died at - line 3.

Replies are listed 'Best First'.
Re^2: Normal regexes stop working
by yegg (Acolyte) on Oct 24, 2010 at 17:14 UTC
    I made this case simple, but in the general case I'm actually doing this:
    my $q_meta = quotemeta($q); my $tmp_test = ($test =~ /$q_meta/i) || 0;
    So it should escape all those special characters.