我有一个字符串,我试图将其拆分为更小的字符串d+\/(任意数字后跟 a /)。这是我的字符串:
2/ This is a string
that has some words on a new line
3/ This is another string that might also have some words on a new line
到目前为止,我正在使用这段代码:
$re = '/\d+\/\s+.*/';
$str = '2/ This is a string
that has some words on a new line
3/ This is another string that might also have some words on a new line';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
但问题是,对于第一场比赛,我只得到第一行:
[Match 1] 2/ This is a string
[Match 2] 3/ This is another string that might also have some words on a new line
我怎样才能让所有的行都匹配到d+\/或直到整个字符串/文本的末尾?
期望的结果:
[Match 1] 2/ This is a string that has some words on a new line
[Match 2] 3/ This is another string that might also have some words on a new line
开心每一天1111