Is there a way in the PHP regex functions to get all possible matches of a regex even if those matches overlap?
e.g. Get all the 3 digit substrings '/[\d]{3}/'...
You might expect to get:
"123456" => ['123', '234', '345', '456']
But preg_match_all() only returns
['123', '456']
This is because it begins searching again after the matched substring (as noted in the documentation):
"After the first match is found, the subsequent searches are continued on from end of the last match.".
Is there a way around this without writing a custom parser?