Skip to content

Files

Latest commit

 

History

History
25 lines (14 loc) · 429 Bytes

Lint-OutOfRangeRegexpRef.md

File metadata and controls

25 lines (14 loc) · 429 Bytes

Pattern: Out of range Regexp reference

Issue: -

Description

This cops looks for references of Regexp captures that are out of range and thus always returns nil.

Examples

/(foo)bar/ =~ 'foobar'

# bad - always returns nil

puts $2 # => nil

# good

puts $1 # => foo

Further Reading