Hello,
I have some data similar to this:
aaa1|aaa2|ZZZ|aaa3|aaa4|aaa5|ZZZ|aaa6|aaa7I want to match all "aaa[0-9]" BETWEEN "ZZZ" (not the ones outside).
So I have some PHP code:
$string = "aaa1aaa2zzzzaaa3aaa4aaa5zzzzaaa6aaa7"; preg_match_all("/zzzz.*(aaa[0-9]).*zzzz/", $string, $matches, PREG_SET_ORDER); print_r($matches);
But it only outputs:
Array ( [0] => Array ( [0] => zzzzaaa3aaa4aaa5zzzz [1] => aaa5 ) )
I want "aaa3", "aaa4" in addition to "aaa5".
Is there a way to do this with 1 call to preg_match_all()
?