开发者

PHP Regular expression to match unescaped double quotes

开发者 https://www.devze.com 2023-03-25 15:56 出处:网络
I\'m trying to figure out a regular expression that will detect if there is an unescaped double quote within two double quotes. I have this, but it\'s not working:

I'm trying to figure out a regular expression that will detect if there is an unescaped double quote within two double quotes. I have this, but it's not working:

if ( preg_match( '/^(\".*((?<!\\)\").*\")$/',开发者_开发百科 $str ) ) {
    die("hey");
}


Try with preg_match('/([^\\]\")/', $str)

0

精彩评论

暂无评论...
验证码 换一张
取 消