I need to be able to try and match a short string inputted on a web form against a 
longer string that I'm pulling from a database.  Normally this would be easy, but the 
text string that the web user might enter could contain a parenthesis, and that seems 
to be throwing the match off.  A simple example:

$web_string = "word(1)";
$db_string = "word(1),word(2),word(3)";

$_ = $db_string;

if (m/$web_string/) {print "match"}
else {print "no match"};


The result of this is "no match" since the parentheses are being evaluated somehow.  
If I remove one of the parentheses in one of the strings, I get an error "unmatched () 
in regexp".  If I remove all of the parentheses from both strings, I get "match".  Is 
there a way that I can get grep to consider everything in the strings, including the 
parentheses, as simple characters?  If I can't, do I need to clean every string before 
the match, removing parentheses and any other offending characters?  Thanks in advance.

Reply via email to