I have a string like this it is array pattern :
["foo","bar","bra bra","xxx123"]
How can i get the foo
,bar
,bra bra
,xxx123
Pattern is ["","",""]
I have a string like this it is array pattern :
["foo","bar","bra bra","xxx123"]
How can i get the foo
,bar
,bra bra
,xxx123
Pattern is ["","",""]
收起
You can do it without regex:
$result = explode('","', trim($str, '[]"'));
or with regex:
if (preg_match_all('~"([^"]*)"~', $str, $m))
$result = $m[1];
or a regex to handle escaped quotes:
if (preg_match_all('~"([^"\\\]*(?s:\\\.[^"\\\]*)*)"~', $str, $m))
$result = $m[1];
报告相同问题?