[ruby-core:121757] [Ruby Bug#21291] possible bug with /m regexp and $ based on input

Issue #21291 has been reported by zenspider (Ryan Davis). ---------------------------------------- Bug #21291: possible bug with /m regexp and $ based on input https://bugs.ruby-lang.org/issues/21291 * Author: zenspider (Ryan Davis) * Status: Open * ruby -v: 3.4.2 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- reported in discord by the.unnamed user: ``` ruby #!/usr/bin/env -S ruby -vw # => ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24] p "a\n" =~ /$./m # => 1 p "a\n" =~ /$.*/m # => 1 p "aa\n" =~ /$./m # => 2 p "aa\n" =~ /$.*/m # !!! # => nil p "aa\n" =~ /$[\S\s]*/m # => 2 ``` goes back to at least 3.2.8 -- https://bugs.ruby-lang.org/

Issue #21291 has been updated by nobu (Nobuyoshi Nakada). 1.8 prints 2 but 1.9 and later print nil. ---------------------------------------- Bug #21291: possible bug with /m regexp and $ based on input https://bugs.ruby-lang.org/issues/21291#change-112816 * Author: zenspider (Ryan Davis) * Status: Open * ruby -v: 3.4.2 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- reported in discord by the.unnamed user: ``` ruby #!/usr/bin/env -S ruby -vw # => ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24] p "a\n" =~ /$./m # => 1 p "a\n" =~ /$.*/m # => 1 p "aa\n" =~ /$./m # => 2 p "aa\n" =~ /$.*/m # !!! # => nil p "aa\n" =~ /$[\S\s]*/m # => 2 ``` goes back to at least 3.2.8 -- https://bugs.ruby-lang.org/

Issue #21291 has been updated by dodecadaniel (Daniel Colson). Possible fix: https://github.com/ruby/ruby/pull/13200 ---------------------------------------- Bug #21291: possible bug with /m regexp and $ based on input https://bugs.ruby-lang.org/issues/21291#change-112818 * Author: zenspider (Ryan Davis) * Status: Open * ruby -v: 3.4.2 * Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED ---------------------------------------- reported in discord by the.unnamed user: ``` ruby #!/usr/bin/env -S ruby -vw # => ruby 3.4.2 (2025-02-15 revision d2930f8e7a) +PRISM [arm64-darwin24] p "a\n" =~ /$./m # => 1 p "a\n" =~ /$.*/m # => 1 p "aa\n" =~ /$./m # => 2 p "aa\n" =~ /$.*/m # !!! # => nil p "aa\n" =~ /$[\S\s]*/m # => 2 ``` goes back to at least 3.2.8 -- https://bugs.ruby-lang.org/
participants (3)
-
dodecadaniel (Daniel Colson)
-
nobu (Nobuyoshi Nakada)
-
zenspider (Ryan Davis)