Actions
Bug #2547
closederror when interpolating a string containing a single backslash into a regexp
Description
=begin
An error is raised if an interpolation in a regexp contains a string containing a single backslash. This case used to work just great in ruby 1.8. For example:
$ ruby19 -e 'a="\"; p /#{a}y/'
-e:1:in `': too short escape sequence (ArgumentError)
Note that if the string literal is inlined directly into the interpolation, the error does not happen. I'd guess that ruby optimizes this case away at parse time, and thus sidesteps the error:
$ ruby19 -e 'p /#{"\"}y/'
/\y/
I've tested this in 1.9.1; presumably 1.9.2 has the same behavior, but I don't have a 1.9.2 readily available.
=end
Actions
Like0
Like0Like0Like0