Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regexp#source behaviour has changed in MRI 2 #2283

Closed
chrisseaton opened this issue Dec 6, 2014 · 2 comments
Closed

Regexp#source behaviour has changed in MRI 2 #2283

chrisseaton opened this issue Dec 6, 2014 · 2 comments

Comments

@chrisseaton
Copy link
Contributor

It looks like the Regexp#source behaviour changed has in MRI. I couldn't immediately see how to fix this. It doesn't appear to be covered by RubySpec yet.

$ ~/.rbenv/versions/1.8.7-p375/bin/ruby ../test.rb 
"/"
"\\/"

$ ~/.rbenv/versions/1.9.3-p550/bin/ruby ../test.rb 
"/"
"\\/"

$ ~/.rbenv/versions/2.0.0-p594/bin/ruby ../test.rb 
"/"
"/"

$ ~/.rbenv/versions/rbx-2.2.10/bin/ruby ../test.rb 
"/"
"\\/"

$ bin/jruby ../test.rb 
"/"
"\\/"

$ cat ../test.rb 
p %r[/].source
p /\//.source
@cremno
Copy link

cremno commented Dec 12, 2014

It isn't just Regexp#source. The regular expressions themselves are different until MRI/CRuby 2.0.0. But %r[/] being the same as /\// makes sense, doesn't it?

@enebo enebo modified the milestone: JRuby 9.0.0.0 Jul 14, 2015
@kares
Copy link
Member

kares commented Mar 2, 2018

all seems well in ~ current JRuby 9K :

jruby-9.1.15.0 :001 > p %r[/].source
"/"
 => "/" 
jruby-9.1.15.0 :002 > p /\//.source
"/"
 => "/" 

@kares kares closed this as completed Mar 2, 2018
@kares kares added this to the Invalid or Duplicate milestone Mar 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants