[#113435] [Ruby master Feature#19634] Pattern matching dynamic key — "baweaver (Brandon Weaver) via ruby-core" <ruby-core@...>
Issue #19634 has been reported by baweaver (Brandon Weaver).
6 messages
2023/05/09
[#113489] [Ruby master Bug#19642] Remove vectored read/write from `io.c`. — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>
Issue #19642 has been reported by ioquatix (Samuel Williams).
10 messages
2023/05/15
[ruby-core:113477] [Ruby master Bug#19639] Escaped newline literals in Regexp are ignored in extended / free-spacing mode
From:
janosch-x via ruby-core <ruby-core@...>
Date:
2023-05-14 10:08:40 UTC
List:
ruby-core #113477
Issue #19639 has been reported by janosch-x (Janosch M=FCller). ---------------------------------------- Bug #19639: Escaped newline literals in Regexp are ignored in extended / fr= ee-spacing mode https://bugs.ruby-lang.org/issues/19639 * Author: janosch-x (Janosch M=FCller) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin21] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- When we want to match whitespace with a Regexp that uses the x-flag, we can= do that with escaped literal whitespace: ```ruby ' '[/\ /x] # =3D> " " ``` This works for all whitespace - except newlines: ```ruby "\n"[/\ /x] # =3D> "" /\ /x.source # =3D> "" ``` I guess another parsing step eliminates such escaped newlines before the re= gexp parsing happens? It is probably a rare issue because most people prefer "\n" in Regexps over= literal newlines, but at least the relevant statement in the [documentatio= n](https://docs.ruby-lang.org/en/master/regexp_rdoc.html#label-Free-Spacing= +Mode+and+Comments) is a bit too broad as it is: > Use escaped whitespace such as \ , i.e. a space preceded by a backslash. Maybe we want to add a caveat like `(Does not work for newlines.)`? --=20 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-c= ore.ml.ruby-lang.org/