Project

General

Profile

Actions

Bug #8651

closed

/[#$]/ causes syntax error

Added by sakuro (Sakuro OZAWA) almost 11 years ago. Updated over 10 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
[ruby-core:56069]

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

Updated by drbrain (Eric Hodel) over 10 years 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

Updated by sakuro (Sakuro OZAWA) over 10 years ago

drbrain (Eric Hodel) wrote:

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

do you mean $], not $[ ?

Updated by sakuro (Sakuro OZAWA) over 10 years ago

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

Updated by sakuro (Sakuro OZAWA) over 10 years ago

=begin
Bah,

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

Updated by drbrain (Eric Hodel) over 10 years ago

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0