Bug #8651

/[#$]/ causes syntax error

Added by Sakuro OZAWA 9 months ago. Updated 9 months ago.

[ruby-core:56069]
Status:Rejected
Priority:Normal
Assignee:-
Category:-
Target version:-
ruby -v:ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0] Backport:1.9.3: UNKNOWN, 2.0.0: UNKNOWN

Description

=begin
On ruby 1.9.3-p448, a regular expression (({/[#$]/})) (character class which contains two characters, (({#})) and (({$}))) causes

syntax error, unexpected $undefined.

Ruby 2.0 accepts this and (({Regexp.new('[#$]')})) is OK on both versions.

=end

History

#1 Updated by Eric Hodel 9 months ago

  • Status changed from Open to Rejected

=begin
This is consistent with (({"[#$]"})) in 1.9.3 so I will reject this issue.

In // and "" (({#$X})) interpolates global variable (({$X})). As (({$[})) is not a valid global variable you get an exception.
=end

#2 Updated by Sakuro OZAWA 9 months ago

drbrain (Eric Hodel) wrote:

$[ is not a valid global variable you get an exception.

do you mean $], not $[ ?

#3 Updated by Sakuro OZAWA 9 months ago

=begin
To people curious about why this does not cause error in 2.0, see #8651.
=end

#4 Updated by Sakuro OZAWA 9 months ago

=begin
Bah,

To people curious about why this does not cause error in 2.0, see #8375.
=end

#5 Updated by Eric Hodel 9 months ago

Yes, I meant $], it was a typo.

Also available in: Atom PDF