Preg Spilit
我很难让这个工作起来。我有一个字符串:
input : Organizer, Pocket Office (Word, Excel, PowerPoint, PDF Viewer)
output : Organizer Pocket Office (Word, Excel, PowerPoint, PDF Viewer)
任何人都有任何想法获得Pattern Regex?
答案 0 :(得分:1)
如果您不想在括号内用逗号分隔,可以(*SKIP)(*F)括号内容:
$pattern = '/\([^)]+\)(*SKIP)(*F)|,\s*/';
请参阅test at regex101,test at eval.in
$res = preg_split($pattern, $str);
答案 1 :(得分:0)