From: Shri Borde Date: 2009-02-06T03:31:26+09:00 Subject: [ruby-core:21869] Re: What does this regexp mean - /\c#{_J}/ Ah, ok. -----Original Message----- From: Tomas Matousek [mailto:Tomas.Matousek@microsoft.com] Sent: Thursday, February 05, 2009 10:26 AM To: ruby-core@ruby-lang.org Subject: [ruby-core:21867] Re: What does this regexp mean - /\c#{_J}/ \c converts the following character (which happens to be # in this case) to a control character. So #{} is not treated as an expression in this case. irb(main):001:0> "\c#{foo}" => "\003{foo}" Tomas -----Original Message----- From: Shri Borde [mailto:Shri.Borde@microsoft.com] Sent: Thursday, February 05, 2009 9:55 AM To: ruby-core@ruby-lang.org Subject: [ruby-core:21860] Re: What does this regexp mean - /\c#{_J}/ Actually, with strings, the regexp is evaluated at the very end after substituting all the variables. So this should have actually worked. Here is the spec I will add. The not_compliant_on(:ruby) means that it is a Ruby bug it "allows substitution to interact with other Regexp constructs" do str = "foo)|(bar" /(#{str})/.should == /(foo)|(bar)/ str = "a" /[#{str}-z]/.should == /[a-z]/ not_compliant_on(:ruby) do str = "J" re = /\c#{str}/.should == /\cJ/ end end -----Original Message----- From: Shri Borde Sent: Wednesday, February 04, 2009 3:33 PM To: ruby-core@ruby-lang.org Subject: RE: [ruby-core:21839] Re: What does this regexp mean - /\c#{_J}/ Makes sense -----Original Message----- From: Charles.O.Nutter@sun.com [mailto:Charles.O.Nutter@sun.com] On Behalf Of Charles Oliver Nutter No warnings in JRuby but we appear to do the same thing. Parser artifact no doubt...I'd call it a bug. - Charlie