Skip to content

Files

Latest commit

 

History

History
28 lines (19 loc) · 616 Bytes

Lint-AmbiguousRegexpLiteral.md

File metadata and controls

28 lines (19 loc) · 616 Bytes

Pattern: Ambiguous RegExp literal

Issue: -

Description

This rule checks for ambiguous RegExp literals in the first argument of a method invocation without parentheses.

Examples

# bad

# This is interpreted as a method invocation with a RegExp literal,
# but it could possibly be `/` method invocations.
# (i.e. `do_something./(pattern)./(i)`)
do_something /pattern/i
# good

# With parentheses, there's no ambiguity.
do_something(/pattern/i)

Further Reading