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


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

Please help me.

Member Avatar for diafol

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

Just take off the $ - should work then.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.