Skip to content

Commit 75951ac

Browse files
committed
Bump version to 1.5.0
1 parent a2209cc commit 75951ac

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ project adheres to [Semantic Versioning](http://semver.org/).
55
Older versions are detailed as [GitHub
66
releases](https://github.com/mudge/re2/releases) for this project.
77

8+
## [1.5.0] - 2022-10-16
9+
### Added
10+
- Added RE2::Set for simultaneously searching a collection of patterns
11+
812
## [1.4.0] - 2021-03-29
913
### Fixed
1014
- Fixed a crash when using RE2::Scanner#scan with an invalid regular expression
@@ -69,6 +73,7 @@ releases](https://github.com/mudge/re2/releases) for this project.
6973
### Fixed
7074
- In Ruby 1.9.2 and later, re2 will now set the correct encoding for strings
7175

76+
[1.5.0]: https://github.com/mudge/re2/releases/tag/v1.5.0
7277
[1.4.0]: https://github.com/mudge/re2/releases/tag/v1.4.0
7378
[1.3.0]: https://github.com/mudge/re2/releases/tag/v1.3.0
7479
[1.2.0]: https://github.com/mudge/re2/releases/tag/v1.2.0

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ re2 [![Build Status](https://github.com/mudge/re2/actions/workflows/tests.yml/ba
44
A Ruby binding to [re2][], an "efficient, principled regular expression
55
library".
66

7-
**Current version:** 1.4.0
7+
**Current version:** 1.5.0
88
**Supported Ruby versions:** 1.8.7, 1.9.3, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0
99
**Supported re2 versions:** libre2.0 (< 2020-03-02), libre2.1 (2020-03-02), libre2.6 (2020-03-03), libre2.7 (2020-05-01), libre2.8 (2020-07-06), libre2.9 (2020-11-01)
1010

@@ -131,6 +131,22 @@ enum.next #=> ["It"]
131131
enum.next #=> ["is"]
132132
```
133133

134+
As of 1.5.0, you can use `RE2::Set` to match multiple patterns against a
135+
string. Calling `RE2::Set#add` with a pattern will return an integer index of
136+
the pattern. After all patterns have been added, the set can be compiled using
137+
`RE2::Set#compile`, and then `RE2::Set#match` will return an `Array<Integer>`
138+
containing the indices of all the patterns that matched.
139+
140+
``` ruby
141+
set = RE2::Set.new
142+
set.add("abc") #=> 0
143+
set.add("def") #=> 1
144+
set.add("ghi") #=> 2
145+
set.compile #=> true
146+
set.match("abcdefghi") #=> [0, 1, 2]
147+
set.match("ghidefabc") #=> [2, 1, 0]
148+
```
149+
134150
Features
135151
--------
136152

@@ -149,6 +165,8 @@ Features
149165

150166
* Incrementally scanning text with `re2.scan(text)`
151167

168+
* Search a collection of patterns simultaneously with `RE2::Set`
169+
152170
* Checking regular expression compilation with `re2.ok?`, `re2.error` and
153171
`re2.error_arg`
154172

@@ -177,7 +195,9 @@ Contributions
177195
* Thanks to [Sebastian Reitenbach](https://github.com/buzzdeee) for reporting
178196
the deprecation and removal of the `utf8` encoding option in re2;
179197
* Thanks to [Sergio Medina](https://github.com/serch) for reporting a bug when
180-
using `RE2::Scanner#scan` with an invalid regular expression.
198+
using `RE2::Scanner#scan` with an invalid regular expression;
199+
* Thanks to [Pritam Baral](https://github.com/pritambaral) for contributed the
200+
initial support for `RE2::Set`.
181201

182202
Contact
183203
-------

re2.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
22
s.name = "re2"
33
s.summary = "Ruby bindings to re2."
44
s.description = 'Ruby bindings to re2, "an efficient, principled regular expression library".'
5-
s.version = "1.4.0"
5+
s.version = "1.5.0"
66
s.authors = ["Paul Mucur"]
77
s.homepage = "https://github.com/mudge/re2"
88
s.extensions = ["ext/re2/extconf.rb"]
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
2424
"spec/re2/regexp_spec.rb",
2525
"spec/re2/match_data_spec.rb",
2626
"spec/re2/string_spec.rb",
27+
"spec/re2/set_spec.rb",
2728
"spec/re2/scanner_spec.rb"
2829
]
2930
s.add_development_dependency("rake-compiler", "~> 0.9")

0 commit comments

Comments
 (0)