Saturday, 31 August 2013

regex is not working properly - preg_replace or preg_match

regex is not working properly - preg_replace or preg_match

I have the following regex code --
$search_query=preg_replace('#[a-z. .a-z]#i', ' ', $_POST['searchquery']);
My database is lower case. The interpretation that I am going for is:
$search_query should allow all letters on a case insensitive basis and any
white space but ignore symbols and numbers. It should not replace anything
since it is case sensitive. And it should process 'search_query'. Where am
I going wrong...? My hashtags are correct and is i=case insensitive...
Please help...

No comments:

Post a Comment