Project

General

Profile

Actions

Bug #19476

closed

Regexp unexpected partial match

Added by andreccosta (André Costa) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin22]
[ruby-core:112683]

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 #1

Updated by andreccosta (André Costa) over 1 year ago

  • Description updated (diff)
Actions #2

Updated by andreccosta (André Costa) over 1 year ago

  • Description updated (diff)
  • Subject changed from Regexp unexpected match to Regexp unexpected partial match

Updated by hsbt (Hiroshi SHIBATA) over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to make_now_just (Hiroya Fujinami)
Actions #4

Updated by make_now_just (Hiroya Fujinami) over 1 year ago

  • Status changed from Assigned to Closed

Applied in changeset git|dddc542e9b61b292d80a96d0d0efbbf58719e3be.


[Bug #19476]: correct cache index computation for repetition (#7457)

Actions #5

Updated by hsbt (Hiroshi SHIBATA) over 1 year ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED

Updated by naruse (Yui NARUSE) over 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE

ruby_3_2 ad6fe84dfa6935bd6e2c3ef3ee36bed4e8627d0b merged revision(s) dddc542e9b61b292d80a96d0d0efbbf58719e3be.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0