how to check for special characters php [duplicate]
Possible Duplicate:
preg_match php special characters
Hi all, I want to check if these characters exist in a string by using preg_match
:
^'£$%^&*()}{@'#~?><>,@|\-=-_+-¬'
Help please!
<?php
$string = 'foo';
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $string))
{
// one or more of the 'special characters' found in $string
}
preg_match('/'.preg_quote('^\'£$%^&*()}{@#~?><,@|-=-_+-¬', '/').'/', $string);
精彩评论