From: "kddnewton (Kevin Newton) via ruby-core" Date: 2026-11-17T21:46:11+00:00 Subject: [ruby-core:127564] [Ruby Bug#22596] parse.y splits regexp literal on #@, meaning named captures change Issue #22596 has been reported by kddnewton (Kevin Newton). ---------------------------------------- Bug #22596: parse.y splits regexp literal on #@, meaning named captures change https://bugs.ruby-lang.org/issues/22596 * Author: kddnewton (Kevin Newton) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- ```ruby /(?#@)/ =~ "#@" defined?(captured) ``` The `#@` changes this node to a dynamic regexp, which means named captures don't get added to the local table. But that's kind of a quirk of the lexer more than anything, since it's looking for an interpolated variable. Prism makes that a regexp node (as opposed to an interpolated regexp node) meaning the `captured` local gets defined. -- 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/lists/ruby-core.ml.ruby-lang.org/