Iterating matches
Use forEach() to easily iterate matched occurrences with your callback. You can call forEach() with a callback,
that's invoked with Detail.
forEach() is identical to simply iterating the matcher.
Using Detail you can get detailed information such as offset(), index() etc.
Vanilla PHP foreach#
You can also use the result of pattern()->match() directly in PHP foreach loop.