PHP String使用正则表达式进行爆炸 示例数据:
"A" 100000 "M" "C" "J" "JOHNSON TRENCHING" 238910
array (
0 => 'A',
1 => '100000',
2 => 'M',
3 => 'C',
4 => '',
5 => '',
6 => 'JOHNSON TRENCHING',
7 => '238910'
);
答案 0 :(得分:1)
试试这个
$string = '"A" 100000 "M" "C" "J" "JOHNSON TRENCHING" 238910';
$string = preg_match_all('/(\"[a-zA-Z0-9\s]+\")|[0-9]+/', $string, $matches);
print_r($matches);