Skip to content
On this page

Available Rules

💼 Configurations enabled in.
⚠️ Configurations set to warn in.
✅ Set in the plugin:regexp/recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.

Possible Errors

NameDescription💼⚠️🔧💡
no-contradiction-with-assertiondisallow elements that contradict assertions💡
no-control-characterdisallow control characters💡
no-dupe-disjunctionsdisallow duplicate disjunctions💡
no-empty-alternativedisallow alternatives without elements
no-empty-capturing-groupdisallow capturing group that captures empty.
no-empty-character-classdisallow character classes that match no characters
no-empty-groupdisallow empty group
no-empty-lookarounds-assertiondisallow empty lookahead assertion or empty lookbehind assertion
no-escape-backspacedisallow escape backspace ([\b])
no-invalid-regexpdisallow invalid regular expression strings in RegExp constructors
no-lazy-endsdisallow lazy quantifiers at the end of an expression
no-misleading-capturing-groupdisallow capturing groups that do not behave as one would expect💡
no-misleading-unicode-characterdisallow multi-code-point characters in character classes and quantifiers🔧💡
no-missing-g-flagdisallow missing g flag in patterns used in String#matchAll and String#replaceAll🔧
no-optional-assertiondisallow optional assertions
no-potentially-useless-backreferencedisallow backreferences that reference a group that might not be matched
no-super-linear-backtrackingdisallow exponential and polynomial backtracking🔧
no-super-linear-movedisallow quantifiers that cause quadratic moves
no-useless-assertionsdisallow assertions that are known to always accept (or reject)
no-useless-backreferencedisallow useless backreferences in regular expressions
no-useless-dollar-replacementsdisallow useless $ replacements in replacement string
strictdisallow not strictly valid regular expressions🔧💡

Best Practices

NameDescription💼⚠️🔧💡
confusing-quantifierdisallow confusing quantifiers
control-character-escapeenforce consistent escaping of control characters🔧
negationenforce use of escapes on negation🔧
no-dupe-characters-character-classdisallow duplicate characters in the RegExp character class🔧
no-extra-lookaround-assertionsdisallow unnecessary nested lookaround assertions🔧
no-invisible-characterdisallow invisible raw character🔧
no-legacy-featuresdisallow legacy RegExp features
no-non-standard-flagdisallow non-standard flags
no-obscure-rangedisallow obscure character ranges
no-octaldisallow octal escape sequence💡
no-standalone-backslashdisallow standalone backslashes (\)
no-trivially-nested-assertiondisallow trivially nested assertions🔧
no-trivially-nested-quantifierdisallow nested quantifiers that can be rewritten as one quantifier🔧
no-unused-capturing-groupdisallow unused capturing group🔧💡
no-useless-character-classdisallow character class with one character🔧
no-useless-flagdisallow unnecessary regex flags🔧
no-useless-lazydisallow unnecessarily non-greedy quantifiers🔧
no-useless-quantifierdisallow quantifiers that can be removed🔧💡
no-useless-rangedisallow unnecessary range of characters by using a hyphen🔧
no-useless-two-nums-quantifierdisallow unnecessary {n,m} quantifier🔧
no-zero-quantifierdisallow quantifiers with a maximum of zero💡
optimal-lookaround-quantifierdisallow the alternatives of lookarounds that end with a non-constant quantifier
optimal-quantifier-concatenationrequire optimal quantifiers for concatenated quantifiers🔧
prefer-escape-replacement-dollar-charenforces escape of replacement $ character ($$).
prefer-predefined-assertionprefer predefined assertion over equivalent lookarounds🔧
prefer-quantifierenforce using quantifier🔧
prefer-rangeenforce using character class range🔧
prefer-regexp-execenforce that RegExp#exec is used instead of String#match if no global flag is provided
prefer-regexp-testenforce that RegExp#test is used instead of String#match and RegExp#exec🔧
require-unicode-regexpenforce the use of the u flag🔧
sort-alternativessort alternatives if order doesn't matter🔧
use-ignore-caseuse the i flag if it simplifies the pattern🔧

Stylistic Issues

NameDescription💼⚠️🔧💡
hexadecimal-escapeenforce consistent usage of hexadecimal escape🔧
letter-caseenforce into your favorite case🔧
match-anyenforce match any character style🔧
no-useless-escapedisallow unnecessary escape characters in RegExp🔧
no-useless-non-capturing-groupdisallow unnecessary Non-capturing group🔧
prefer-character-classenforce using character class🔧
prefer-denforce using \d🔧
prefer-lookaroundprefer lookarounds over capturing group that do not replace🔧
prefer-named-backreferenceenforce using named backreferences🔧
prefer-named-capture-groupenforce using named capture groups
prefer-named-replacementenforce using named replacement🔧
prefer-plus-quantifierenforce using + quantifier🔧
prefer-question-quantifierenforce using ? quantifier🔧
prefer-result-array-groupsenforce using result array groups🔧
prefer-star-quantifierenforce using * quantifier🔧
prefer-unicode-codepoint-escapesenforce use of unicode codepoint escapes🔧
prefer-wenforce using \w🔧
sort-character-class-elementsenforces elements order in character class🔧
sort-flagsrequire regex flags to be sorted🔧
unicode-escapeenforce consistent usage of unicode escape or unicode codepoint escape🔧

Deprecated

NameDescription💼⚠️🔧💡
no-assertion-capturing-groupdisallow capturing group that captures empty.
no-useless-exactly-quantifierdisallow unnecessary exactly quantifier
no-useless-non-greedydisallow unnecessarily non-greedy quantifiers🔧
order-in-character-classenforces elements order in character class🔧
prefer-tenforce using \t🔧