Regexp-Exhaustive reviews

RSS | Module Info

Regexp-Exhaustive (0.04) *****

This module allows you to find all the ways that a regexp matches, not just the first one it finds.

Essentially it works by appending the following to the end of the supplied regexp:

(?{ record_match(); })(*FAIL)

Every match that makes it to the end of your regexp will have its offset and length (and, very importantly, $^R) recorded. Then the regexp will be artificially FAILed, invoking the regexp engine's backtracking behaviour in order to find the next match.

This module is careful not to needlessly copy your supplied input string which is nice for efficiency.

Not useful that often, but very useful when you need it.