我正在尝试使用preg_split拆分此文本
Yes, it was great. [I have no ideas how great it was.]
进入此数组:
['Yes', 'it', 'was', great', '[I have no ideas how great it was.]'
但是我不知道如何...
答案 0 :(得分:1)
$keywords = preg_split("/[\s,.]+(?![^[]*])/", "Yes, it was great. [I have no ideas how great it was.]");
print_r($keywords);