[英]php regex for string between :“ and ”
我正在尝试使用preg_match_all在PHP数组中获取:"
和"
之间的字符串。
例如:
"I am a string"("string"):"Need this string", "I am a string"("string"):"Need this string", etc, etc
我有以下内容,但它不返回结果或错误,并且可以在我尝试过的正则表达式生成器中运行。
/\"\:"(.*?)\"/ and #/\"\:"(.*?)\"/#
这样可以使表达式更简单:
if (preg_match_all('/:"(.*?)"/', $str, $matches)) {
// $matches[1] will contain all the strings you want
}
试试这个模式:
#:"([^"]*)"#
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.