Ruby bindings to RE2, a "fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python".
Add new options to RE2::Regexp#match that expose the underlying capabilities of RE2's Match function:
anchor: specifying whether a match should be unanchored (the default), anchored to the start of the text or anchored to both ends
startpos: the offset at which to start matching (defaults to the start of the text)
submatches: the number of submatches to extract (defaults to the number of capturing groups in the pattern)
We keep compatibility with the previous API by still accepting a number of submatches as the second argument to match.
With these new options in place, we can now offer a higher-level RE2::Regexp#full_match and RE2::Regexp#partial_match API to match RE2's own. Note we don't actually use the underlying FullMatchN or PartialMatchN functions as we need to use Match's behaviour of returning the overall match first before any extracted submatches.
The plan is to then heavily promote these two methods over the lower-level match.
GitHub: https://github.com/mudge/re2/issues/119
Add new options to
RE2::Regexp#match
that expose the underlying capabilities of RE2's Match function:We keep compatibility with the previous API by still accepting a number of submatches as the second argument to match.
With these new options in place, we can now offer a higher-level
RE2::Regexp#full_match
andRE2::Regexp#partial_match
API to match RE2's own. Note we don't actually use the underlyingFullMatchN
orPartialMatchN
functions as we need to useMatch
's behaviour of returning the overall match first before any extracted submatches.The plan is to then heavily promote these two methods over the lower-level
match
.