Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Cop idea: Out of range referencing for Regexp #7755
Is your feature request related to a problem? Please describe.
When a reference for Regepx is out of range, it always returns nil.
/(foo)bar/ =~ 'foobar' # ok p $1 # => foo # bad - $2 always returns nil. p $2 # => nil
Describe the solution you'd like
Add a cop to detect the problem.
Describe alternatives you've considered
We will be able to the cop with regexp_parser gem. ref: #7746