Skip to main content

Release 0.9.6 - First/all changes!

Another release ahead of us. This one is about T-Regx chainable interface. We made sure, that first() chained with anything always uses preg_match(), instead of preg_match_all().

For example:

pattern($pattern)->match($subject)
->fluent()
->flatMap(function (Match $match) {
return [$match->text() => $match->offset()];
})
->keys()
->groupByCallback(function (string $text) {
return $text[0];
})
->first();

this code will now use preg_match(). Really, this whole release was about ensuring that.

The only exception is filter(), for which it would be really wasteful to call preg_match() first, and then, if the filter has failed, call preg_match_all().

In the future releases we'll make sure that the exception for unmatched first() are also uniform (probably SubjectNotMatchedException, instead of NoSuchFluentElementException).

Boy, are design patterns so cool for this kind of job ;D