Release 0.9.8 - foreach baby, foreach!

Iterables

Up to this point, you could either use T-Regx methods that return array, in order to iterate them, or use one of the collection methods map(), forEach(), filter(), etc.

Right now any chainable method in T-Regx is also iterate

foreach (pattern('\d+')->match('127.0.0.1') as $match) {
foreach (pattern('\d+')->match('127.0.0.1')->asInt() as $digit) {
foreach (pattern('\d+')->match('127.0.0.1')->all() as $text) {

Shorthand method

In addition to previous release, when we added asArray() method, we also added a shorthand get() method for capturing groups.

pattern('(origin/)?master')->match('master')->first(function (Match $match) {
$match->get(1); // same as $match->group(1)->text();
});