in reply to regex special chars

Read up on the function quotemeta.

Alternatively, wrap it with \Q$regexp\E in your regexp like this:

my $text = 'foo bar + \wbaz'; my $re = ' + \w'; if ($text =~ /(\Q$re\E)/) { print $1; } else { warn "nothing found\n"; }

That goes for the same as quotemeta does, just for the regexp.

Mats