Actions
Bug #19476
closedRegexp unexpected partial match
Description
This regular expression does not have the expected match since Ruby 3.2.
Ruby 3.2.1:
> RUBY_VERSION
=> "3.2.1"
> "123456789".match(/(\(?\d-?\)?){6,15}/)
=> #<MatchData "123456" 1:"6">
> "123456789".match(/(\d-?\)?){6,}/)
=> #<MatchData "123456" 1:"6">
Results in a partial match even though the specified quantifiers should allow matching the whole string.
Ruby 3.1.3:
> RUBY_VERSION
=> "3.1.3"
> "123456789".match(/(\(?\d-?\)?){6,15}/)
=> #<MatchData "123456789" 1:"9">
> "123456789".match(/(\d-?\)?){6,}/)
=> #<MatchData "123456789" 1:"9">
Which is the outcome for both patterns in previous versions.
Actions
Like0
Like0Like0Like0Like0Like0Like0