Skip to content

Commit

Permalink
Bump version to 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mudge committed Oct 22, 2022
1 parent 386a495 commit 8bb59cf
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ project adheres to [Semantic Versioning](http://semver.org/).
Older versions are detailed as [GitHub
releases](https://github.com/mudge/re2/releases) for this project.

## [1.6.0] - 2022-10-22
### Added
- Added RE2::MatchData#deconstruct and RE2::MatchData#deconstruct_keys so they
can be used with Ruby pattern matching

## [1.5.0] - 2022-10-16
### Added
- Added RE2::Set for simultaneously searching a collection of patterns
Expand Down Expand Up @@ -73,6 +78,7 @@ releases](https://github.com/mudge/re2/releases) for this project.
### Fixed
- In Ruby 1.9.2 and later, re2 will now set the correct encoding for strings

[1.6.0]: https://github.com/mudge/re2/releases/tag/v1.6.0
[1.5.0]: https://github.com/mudge/re2/releases/tag/v1.5.0
[1.4.0]: https://github.com/mudge/re2/releases/tag/v1.4.0
[1.3.0]: https://github.com/mudge/re2/releases/tag/v1.3.0
Expand Down
29 changes: 26 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ re2 [![Build Status](https://github.com/mudge/re2/actions/workflows/tests.yml/ba
A Ruby binding to [re2][], an "efficient, principled regular expression
library".

**Current version:** 1.5.0
**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
**Current version:** 1.6.0
**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, 3.1
**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)

Installation
Expand Down Expand Up @@ -137,7 +137,7 @@ the pattern. After all patterns have been added, the set can be compiled using
`RE2::Set#compile`, and then `RE2::Set#match` will return an `Array<Integer>`
containing the indices of all the patterns that matched.

``` ruby
```ruby
set = RE2::Set.new
set.add("abc") #=> 0
set.add("def") #=> 1
Expand All @@ -147,6 +147,27 @@ set.match("abcdefghi") #=> [0, 1, 2]
set.match("ghidefabc") #=> [2, 1, 0]
```

As of 1.6.0, you can use [Ruby's pattern matching](https://docs.ruby-lang.org/en/3.0/syntax/pattern_matching_rdoc.html) against `RE2::MatchData` with both array patterns and hash patterns:

```ruby
case RE2('(\w+) (\d+)').match("Alice 42")
in [name, age]
puts "My name is #{name} and I am #{age} years old"
else
puts "No match!"
end
# My name is Alice and I am 42 years old


case RE2('(?P<name>\w+) (?P<age>\d+)').match("Alice 42")
in {name:, age:}
puts "My name is #{name} and I am #{age} years old"
else
puts "No match!"
end
# My name is Alice and I am 42 years old
```

Features
--------

Expand Down Expand Up @@ -185,6 +206,8 @@ Features
[`RE2.escape(unquoted)`](https://github.com/google/re2/blob/2016-02-01/re2/re2.h#L418) and
`RE2.quote(unquoted)`

* Pattern matching with `RE2::MatchData`

Contributions
-------------

Expand Down
2 changes: 1 addition & 1 deletion re2.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Gem::Specification.new do |s|
s.name = "re2"
s.summary = "Ruby bindings to re2."
s.description = 'Ruby bindings to re2, "an efficient, principled regular expression library".'
s.version = "1.5.0"
s.version = "1.6.0"
s.authors = ["Paul Mucur"]
s.homepage = "https://github.com/mudge/re2"
s.extensions = ["ext/re2/extconf.rb"]
Expand Down

0 comments on commit 8bb59cf

Please sign in to comment.