我有一个这样的字符串
阿卡布达比夫
现在我想把它分成一个序列'a','b',任何字符都跟在字符串'ab'之后,就像这样
Array
(
[0] => a
[1] => b
[2] => c
[3] => a
[4] => b
[5] => d
[6] => a
[7] => b
[8] => eaf
)
我目前的尝试是
$string = "abcabdabeaf";
$split = preg_split("/((?<=a)b)/", $string, -1, PREG_SPLIT_DELIM_CAPTURE);
print_r($split);
但结果是
Array
(
[0] => a
[1] => b
[2] => ca
[3] => b
[4] => da
[5] => b
[6] => eaf
)
可以用正则表达式这样做吗?