A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ota-meshi.github.io/eslint-plugin-regexp/rules/no-lazy-ends.html below:

Website Navigation


regexp/no-lazy-ends | eslint-plugin-regexp

regexp/no-lazy-ends

⚠️ This rule warns in the following configs: 🟢 flat/recommended, 🔵 recommended.

💡 This rule is manually fixable by editor suggestions.

disallow lazy quantifiers at the end of an expression

📖 Rule Details

If a lazily quantified element is the last element matched by an expression (e.g. the a{2,3}? in b+a{2,3}?), we know that the lazy quantifier will always only match the element the minimum number of times. The maximum is completely ignored because the expression can accept after the minimum was reached.

If the minimum of the lazy quantifier is 0, we can even remove the quantifier and the quantified element without changing the meaning of the pattern. E.g. a+b*? and a+ behave the same.

If the minimum is 1, we can remove the quantifier. E.g. a+b+? and a+b behave the same.

If the minimum is greater than 1, we can replace the quantifier with a constant, greedy quantifier. E.g. a+b{2,4}? and a+b{2} behave the same.

🔧 Options json5
{
  "regexp/no-lazy-ends": [
    "error",
    {
      "ignorePartial": true,
    }
  ]
}
❤️ Compatibility

This rule was taken from eslint-plugin-clean-regex.
This rule is compatible with clean-regex/no-lazy-ends rule.

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.8.0

🔍 Implementation

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4