<?php $re = "/(\\$[a-z]{1})(.*?)(?=\\$|$)/"; $str = "10\$athis is text a\$bthis is text b/\$cthis is text\$dthis is text d";
Standard input is empty
Array
(
[0] => Array
(
[0] => $athis is text a
[1] => $bthis is text b/
[2] => $cthis is text
[3] => $dthis is text d
)
[1] => Array
(
[0] => $a
[1] => $b
[2] => $c
[3] => $d
)
[2] => Array
(
[0] => this is text a
[1] => this is text b/
[2] => this is text
[3] => this is text d
)
)