in reply to Make a variable safe for a regex.

Try using the function quotemeta on the variables to escape special characters.