View Full Version : Regular expression

01-20-2012, 10:49 AM
Hi all, i am trying to search an input string for any occurrences of any special characters, but it does not seem to work.

//$data is what the user input, for testing site security purposes i am inputting the following value without the front slashes
//var site_url = "<?php echo base_url();?>";
if (preg_match("/[\<\>\\\.\+\*\?\^\$\[\]\(\)\|\{\}\/\'\#]/", $data))
//do something here

The if loop never turns out true; is there something wrong with my regular expression? Or am i using the wrong function?