|Welcome to the Monastery|
Re: Regex: Searching for a string with special charactersby liverpole (Monsignor)
|on Nov 02, 2006 at 23:28 UTC ( #581981=note: print w/replies, xml )||Need Help??|
I assume by 'brackets' you mean parentheses? That is, '(' and ')'?
Try using \Q ... \E in your regular expression if you want to 'escape' the string being searched against:
You can find more by reading perlre.
And another option is to use the qr/\Q$search\E/ syntax, which you can find in perlop.
Update: Fixed wording (thanks for pointing that out, Hofmator++.)
In Section Seekers of Perl Wisdom