一个 marc 21 标签可能包含带有几个美元符号 $ 的行,例如:
$string='10$athis is text a$bthis is text b/$cthis is text$dthis is text d';
我试图匹配所有的美元歌曲并在每次唱歌后获取文本,我的代码是:
preg_match_all("/\\$[a-z]{1}(.*?)/", $string, $match);
输出是:
Array
(
[0] => Array
(
[0] => $a
[1] => $b
[2] => $c
[3] => $d
)
[1] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
)
)
如何在每次唱歌后捕获文本,因此输出将是:
Array
(
[0] => Array
(
[0] => $a
[1] => $b
[2] => $c
[3] => $d
)
[1] => Array
(
[0] => this is text a
[1] => this is text b/
[2] => this is text c
[3] => this is text d
)
)