I got this regex:
$val = "(123)(4)(56)";
$regex = "^(\((.*?)\))+$";
preg_match_all("/{$regex}/", $val, $matches);
Can anyone please tell me why this matches only the last number (56) and not each set of numbers individually?
This is what $matches contains after the above regex runs:
array
0 =>
array
0 => string '(123)(4)(56)' (length=12)
1 =>
array
0 => string '(56)' (length=4)
2 =>
array
0 => string '56' (length=2)