ammar / regexp_parser

A regular expression parser library for Ruby
MIT License
144 stars 23 forks source link

Multi-byte named capture groups do not parse #76

Closed dgollahon closed 3 years ago

dgollahon commented 3 years ago

Hi again,

I have found one interesting case where regexp_parser will not parse one that MRI accepts:

/(?<æ>.)(.)(?<b>\d+)(\d)/.match('ab12').named_captures # => {"æ"=>"a", "b"=>"1"}

Regexp::Parser.parse(/(?<æ>.)(.)(?<b>\d+)(\d)/) # => Regexp::Scanner::InvalidGroupOption: Invalid group option  in (?

See this line and this line from ruby/spec for where I sourced this case.

Like in #75 I'm just curious if this is intended behavior and, if so, if it can be documented. Otherwise parity with MRI is preferred.

Thanks again!

jaynetics commented 3 years ago

@dgollahon This was definitely a bug.

I've released v2.0.1 with a fix.

Thank you for the excellent quality checkup!

dgollahon commented 3 years ago

Once again, thanks for the prompt fix!