From: "andrykonchin (Andrew Konchin)" Date: 2022-06-21T09:45:57+00:00 Subject: [ruby-core:109032] [Ruby master Feature#18838] Avoid swallowing regexp escapes in the lexer Issue #18838 has been updated by andrykonchin (Andrew Konchin). Thank you for clarification. ---------------------------------------- Feature #18838: Avoid swallowing regexp escapes in the lexer https://bugs.ruby-lang.org/issues/18838#change-98148 * Author: andrykonchin (Andrew Konchin) * Status: Closed * Priority: Normal ---------------------------------------- According to `Regexp#source` documentation: ``` Returns the original string of the pattern. /ab+c/ix.source #=> "ab+c" Note that escape sequences are retained as is. /\x20\+/.source #=> "\\x20\\+" ``` It works well but backslash (/) is processed in different way by different regexp literal forms. Examples: ```ruby /\//.source # => "/" %r/\//.source # => "/" %r{\/}.source # => "\\/" ``` Expected result - in all the cases result is the same. Moreover as documentation states - `escape sequences are retained as is`. So I would say that only `%r{}` works properly. The issue was reported here https://github.com/oracle/truffleruby/issues/2569. -- https://bugs.ruby-lang.org/ Unsubscribe: