[ruby-core:112702] [Ruby master Bug#19476] Regexp unexpected partial match
From:
"hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>
Date:
2023-03-07 00:49:07 UTC
List:
ruby-core #112702
Issue #19476 has been updated by hsbt (Hiroshi SHIBATA).
Status changed from Open to Assigned
Assignee set to make_now_just (Hiroya Fujinami)
----------------------------------------
Bug #19476: Regexp unexpected partial match
https://bugs.ruby-lang.org/issues/19476#change-102160
* Author: andreccosta (Andr=E9 Costa)
* Status: Assigned
* Priority: Normal
* Assignee: make_now_just (Hiroya Fujinami)
* ruby -v: ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
This regular expression does not have the expected match since Ruby 3.2.
Ruby 3.2.1:
```ruby
> RUBY_VERSION
=3D> "3.2.1"
> "123456789".match(/(\(?\d-?\)?){6,15}/)
=3D> #<MatchData "123456" 1:"6">
> "123456789".match(/(\d-?\)?){6,}/)
=3D> #<MatchData "123456" 1:"6">
```
Results in a partial match even though the specified quantifiers should all=
ow matching the whole string.
Ruby 3.1.3:
``` ruby
> RUBY_VERSION
=3D> "3.1.3"
> "123456789".match(/(\(?\d-?\)?){6,15}/)
=3D> #<MatchData "123456789" 1:"9">
> "123456789".match(/(\d-?\)?){6,}/)
=3D> #<MatchData "123456789" 1:"9">
```
Which is the outcome for both patterns in previous versions.
--=20
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-c=
ore.ml.ruby-lang.org/