in reply to Performing substitutions on lines with special characters
Have a look at the quotemetaPerl function. It will escape all characters that are "special" for regular expressions.
Hope this helps, -gjb-