Can someone tell me the regex to see if something is surrounded in double or single quotes.
"this is the string"
i want it to return false if it quotes are not present at all or not present at the start and the en开发者_如何转开发d.
preg_match('/^(["\']).*\1$/m', $string);
will return 1
if the string is surrounded by double quotes and 0
if it is not.
Use:
if (preg_match('#^(\'|").+\1$#', $string) == 1)
精彩评论