Skip to content

2.1.0: Fix encoding inconsistencies & accept String-like inputs with RE2::Set

Compare
Choose a tag to compare
@mudge mudge released this 16 Sep 12:58
· 172 commits to main since this release
d5b0e05

As RE2 only supports UTF-8 and ISO-8859-1 encodings, fix an inconsistency when using string patterns with RE2.Replace and RE2.GlobalReplace where the result would match the encoding of the pattern rather than UTF-8 which is what RE2 will use. This behaviour and limitation is now documented on all APIs that produce string results.

e.g.

# With re2 2.0.0
RE2.Replace("Hello World", "Hello".encode("Windows-1250"), "Hi").encoding
# => #<Encoding:Windows-1250>

# With re2 2.1.0
RE2.Replace("Hello World", "Hello".encode("Windows-1250"), "Hi").encoding
# => #<Encoding:UTF-8>

Other changes

  • The RE2::Set API now accepts anything that can be coerced to a string where previously only strings were permitted, e.g. RE2::Set#add, RE2::Set#match.
  • Added the licences of all vendored dependencies: RE2 and Abseil.
  • Document the behaviour of RE2::Regexp#match when given a pattern with no capturing groups: it will return true or false whether there was a match or not rather than a RE2::MatchData instance.

SHA256 checksums:

b25780558d879c9b2be62f1bd2e4c25a1b5b8bddc31d1cd54253228abb7a8fa5  re2-2.1.0-aarch64-linux.gem
d2be264d95c43877110a859e81aacc6cb6672b9247341f82b45d543317464c58  re2-2.1.0-arm-linux.gem
fac207639de2efae9640443f1a043cbd09f66d74f03ee7c01e033edbf1ef80a2  re2-2.1.0-arm64-darwin.gem
50c2931c183fa92bf3285c88a82fefd640d4eb2b639af305122c7f84aefe431f  re2-2.1.0-x64-mingw-ucrt.gem
d781eb47a25d1dd363a4eab06b012388ea19d5251a1cb0ee766a54df1b5d0b01  re2-2.1.0-x64-mingw32.gem
3ffad83e899d920a6c4f45476c3c12c29d60d20c483573c01844ab3616fc826a  re2-2.1.0-x86-linux.gem
f9ffb84be1b37b20af5f9a5aefbe49714b20ce6b65a34563af360a4bb73fabca  re2-2.1.0-x86-mingw32.gem
125c228d3760f3f837c17aa8edc9526a474cd5c7086febead6545050af5d757b  re2-2.1.0-x86_64-darwin.gem
cabb3ee256ecb70fd4cbfde6d7f6f5062670b6d21191f5ff48404e1054cbb8eb  re2-2.1.0-x86_64-linux.gem
54a3e42bd3860b915c35df6024fb8634442d780ce4c31ccc92506a62151618ae  re2-2.1.0.gem