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

Recursive regex compile fails: (RegexpError) invalid group name <0> #4077

Closed
ryannevell opened this Issue Aug 16, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@ryannevell

ryannevell commented Aug 16, 2016

Environment

$ jruby -v
jruby 9.1.2.0 (2.3.0) 2016-05-26 7357c8f Java HotSpot(TM) 64-Bit Server VM 25.40-b25 on 1.8.0_40-b26 +jit [darwin-x86_64]
$ uname -a
Darwin rnevell-lt.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

Test case

$ cat test.rb

re = /a\g<0>*z/

if "aaazzz".match(re)
  puts "PASS"
else
  puts "FAIL"
  exit 1
end

Expected Behavior

MRI allows recursive regular expressions groups with the \g<0> group which is particularly useful to match balanced expressions (ie parenthesis).

Actual Behavior

Attempting to compile a regular expression with \g<0> in jruby results in:

SyntaxError: (RegexpError) invalid group name <0>: /a\g<0>*z/

lopex added a commit to jruby/joni that referenced this issue Aug 17, 2016

lopex added a commit to jruby/joni that referenced this issue Aug 17, 2016

headius added a commit that referenced this issue Aug 17, 2016

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Aug 17, 2016

Member

Patch for joni appears to work. I've updated master to use it, and we'll release joni 2.1.11 along with 9.1.3.0.

Member

headius commented Aug 17, 2016

Patch for joni appears to work. I've updated master to use it, and we'll release joni 2.1.11 along with 9.1.3.0.

@headius headius added this to the JRuby 9.1.3.0 milestone Aug 17, 2016

@headius headius added the core label Aug 17, 2016

@headius headius closed this in 7c081ff Aug 18, 2016

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Aug 19, 2016

Member

@headius I don't necessarily care but I was realizing this will also enable 1.7.x if we ever update joni. Bonus feature!

Member

enebo commented Aug 19, 2016

@headius I don't necessarily care but I was realizing this will also enable 1.7.x if we ever update joni. Bonus feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment