From: "mrkn (Kenta Murata) via ruby-core" <ruby-core@...> Date: 2022-12-28T03:33:22+00:00 Subject: [ruby-core:111466] [Ruby master Bug#19273] [Regexp] regexp does not does not match expected Issue #19273 has been updated by mrkn (Kenta Murata). I performed git bisect and found the first bad commit is 37613fea1657b1a0732501657275bc03e8e0ebc4. ---------------------------------------- Bug #19273: [Regexp] regexp does not does not match expected https://bugs.ruby-lang.org/issues/19273#change-100837 * Author: taichi730 (Taichi Ishitani) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- 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) #=> #<MatchData "10"> "0:0:0".match(pattern) #=> #<MatchData "0:0:0"> ``` 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) #=> #<MatchData "10:0:0"> "0:0:0".match(pattern) #=> #<MatchData "0:0:0"> ``` 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/