Hi all,
I want to block some of the special charcters using preg_match.
I used following code.It works fine with including ' and ".
After including ' and " it willnot working

<?php
if($_REQUEST['sub'])
{
$Data=$_REQUEST['data'];

$regexp = '/[#$%^&*+={}<>\'\"]+$/';
echo preg_match($regexp, $Data);
                    if (preg_match($regexp, $Data)) 
                    {
                        echo "ERROR";
                    }
}
?>
<form>
<input type="text" name="data" >
<input type="submit" name="sub">
</form>

Please help me.

Member Avatar

So is this meant to search for the last characters of the string?

Just take off the $ - should work then.