I am trying to match words or complete phrase (excluding special characters)
like:

 

1.      Tom 
2.      Tom and Jerry 
3.      Audio A4 Quattro 

 

I need to ensure users cannot feed my program with special characters so I
tried this below, but it doesn't match correctly.

 

 

$string =~ s/\$%\?\^!\+\@'\\|`\?#~=\*><"//g;

    .

if ($keyword !~ /^([A-Za-z0-9]+)\s?\1*$/){

 

        print "Invalid Keyword. Please check and try again\n";

 

 }

 

My pattern worked at this point, but I modified it over and over again an
now this doesn't work at all.

 

Mimi

 

Reply via email to