有人能告诉我如何使用正则表达式来判断某个内容是否被单引号或双引号包围吗?
"this is the string"
.*
.+
\1
使用:
if (preg_match('#^(\'|").+\1$#', $string) == 1)
.*
代替.+
),以及“引号格式错误”(通过\1
处理)。 - undefined