0

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.

2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by diafol
0

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

Just take off the $ - should work then.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.