How do I look for “ and ” in php using preg_match?
-
05-07-2019 - |
Question
I've been using "/x{201C}/u"
and "/x{201D}/u"
to match them, but there's no result.
Am I doing something wrong??
Solution
I've been using
"/x{201C}/u"
and"/x{201D}/u"
to match them, but there's no result.
You need to type "/\x{201C}/u"
and "/\x{201D}/u"
OTHER TIPS
Oh.. shoot! that's a stupid question... '|“|' and "|”|" works!
Have you tried
\x8c and \x9d
Those have worked for me.
if your requirement is that simple as just finding double quotes, just use PHP's string methods
$str='mystring_with_"_blah';
if ( strpos($str,'"') !==FALSE){
print "Found double quotes\n";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow