Skip to content

2.25.0: RE2.extract and expanded API for RE2::Regexp and RE2::MatchData

Choose a tag to compare

@mudge mudge released this 31 Mar 09:51
· 20 commits to main since this release
068e5e0

Added

  • Add RE2.extract to expose RE2's Extract API which returns a given rewrite string with substitutions for a given text and matching pattern (non-matching portions are ignored).
  • Add RE2::Regexp#names and RE2::MatchData#names to return an array of named capturing group names.
  • Add RE2::MatchData#captures to return an array of matches.
  • Add RE2::MatchData#named_captures to return a hash of named capturing group names (either as strings or symbols) to matches.
  • Add RE2::Regexp#named_captures to return a hash of named capturing group names to match indexes (this is an alias to the existing RE2::Regexp#named_capturing_groups).
  • Add RE2::MatchData#values_at to retrieve multiple matches at once by name or index.
  • Add RE2::MatchData#pre_match and RE2::MatchData#post_match for retrieving the string before and after a match.
  • Add RE2::MatchData#offset for fetching the beginning and end offset for a given match by name or index.
  • Add RE2::MatchData#match_length for fetching the length of a match by name or index without allocating a new string.

Changed

  • Prefer the more idiomatic naming of RE2.replace, RE2.global_replace, and RE2.escape (though the old API of RE2.Replace, RE2.GlobalReplace, and RE2.QuoteMeta will continue to work).

SHA256 checksums:

6f85da8ee6c3bd3ebe808e199af6db1b51d86bf69182ab4fe9e39eae37b2628e  re2-2.25.0-aarch64-linux-gnu.gem
05cd4018dd7a4b464257fe7f69dfe94e1301b37c890e0cdc3806d6efa68737e1  re2-2.25.0-aarch64-linux-musl.gem
943aa3c146fc687a44912bfbbd66a0ed0e302600544aa1f63ed1fdce726e6824  re2-2.25.0-arm-linux-gnu.gem
860c38d4eef2207cd87c7127dee484a549756bc00e181e85b9ef16ee41c95386  re2-2.25.0-arm-linux-musl.gem
48305650e10b282ebfec7fedb785ac0f571203186b71ca425d3f1b9dea94750f  re2-2.25.0-arm64-darwin.gem
e92ab523020d04a991020d574d6462d191d7e8729595eef0a48a547d3d5136b7  re2-2.25.0-x64-mingw-ucrt.gem
5a337e00b1e8810bfd0d7ea4b63062ff97147ff16a5c4da3327b8e6d7683b212  re2-2.25.0-x86_64-darwin.gem
be27268b2c08c52c55859714559da5dae2250664a5fbea97b0563676dad69591  re2-2.25.0-x86_64-linux-gnu.gem
31ab06332d00a799e1b7cd920d71eedd89b4dba9a7ad4a71af65d4500665564d  re2-2.25.0-x86_64-linux-musl.gem
d0914cb7a2eddfd041c1abaa9cccd0f5816eff2bcc2e55380aefd1cedd555d89  re2-2.25.0.gem