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
)
)