From: "naruse (Yui NARUSE) via ruby-core" Date: 2022-12-29T11:26:55+00:00 Subject: [ruby-core:111504] [Ruby master Bug#19273] [Regexp] regexp does not match expected Issue #19273 has been updated by naruse (Yui NARUSE). 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 a7d467a792c644a7260d6560ea2002fdb8ff6de3 merged revision(s) b726d60c986bf951d13e7a2ab5f5e58f58657b03. ---------------------------------------- Bug #19273: [Regexp] regexp does not match expected https://bugs.ruby-lang.org/issues/19273#change-100870 * Author: taichi730 (Taichi Ishitani) * Status: Closed * Priority: Normal * Assignee: make_now_just (Hiroya Fujinami) * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux] * Backport: 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE ---------------------------------------- A regexp pattern does not match expected with Ruby 3.2. Ruby 3.2 ``` ruby pattern = /(?-mix:(?i-mx:[+-]?0b[01](?:_?[01])*)|(?-mix:[+-]?(?:[1-9]_?(?:\d_?)*)?\d)|(?i-mx:[+-]?0x\h(?:_?\h)*))(?::(?-mix:(?i-mx:[+-]?0b[01](?:_?[01])*)|(?-mix:[+-]?(?:[1-9]_?(?:\d_?)*)?\d)|(?i-mx:[+-]?0x\h(?:_?\h)*))){0,3}/ "10:0:0".mathc(pattern) #=> # "0:0:0".match(pattern) #=> # ``` String "10.0.0" is only partially matched but not all of it. Ruby 3.1.0: ```ruby pattern = /(?-mix:(?i-mx:[+-]?0b[01](?:_?[01])*)|(?-mix:[+-]?(?:[1-9]_?(?:\d_?)*)?\d)|(?i-mx:[+-]?0x\h(?:_?\h)*))(?::(?-mix:(?i-mx:[+-]?0b[01](?:_?[01])*)|(?-mix:[+-]?(?:[1-9]_?(?:\d_?)*)?\d)|(?i-mx:[+-]?0x\h(?:_?\h)*))){0,3}/ "10:0:0".match(pattern) #=> # "0:0:0".match(pattern) #=> # ``` Both strings matches with the regexp wholy. -- 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-core.ml.ruby-lang.org/