开发者

fixing a regex pattern to be more precise

alertsystem.notification = {"msgId":"1","msgTitle":"Message","msgBody":"No new message.","msgLink":"","msgImage":""};

I am trying to match the values for of the follow variables in the code above. I have been using this pattern preg_match('#(\[\{.*?\}\])#s', $html, $match); up until last week then it stopp开发者_JAVA百科ed working.

Is there a way to include alertsystem.go = in the pattern so that I am sure to get a match?


You want preg_match_all and then take a look at $matches[0]. Your regex could also be: #alertsystem\.notification\s*\=\s*\{.*?\}#is

Add parenthesis where appropriate to capture specific sections.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜