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.
加载中,请稍侯......
精彩评论