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-empty-lookarounds-assertion.html below:

Website Navigation


regexp/no-empty-lookarounds-assertion | eslint-plugin-regexp

regexp/no-empty-lookarounds-assertion

💼 This rule is enabled in the following configs: 🟢 flat/recommended, 🔵 recommended.

disallow empty lookahead assertion or empty lookbehind assertion

📖 Rule Details

This rule reports empty lookahead assertion or empty lookbehind assertion.

What are empty lookarounds?

An empty lookaround is a lookaround for which at least one path in the lookaround expression contains only elements that do not consume characters and do not assert characters. This means that the lookaround expression will trivially accept any input string.

Examples:

Why are empty lookarounds a problem?

Because empty lookarounds accept the empty string, they are essentially non-functional. They will always trivially reject/accept.

E.g. (?=b?)\w will match a just fine. (?=b?) will always trivially accept no matter the input string. The same also happens for negated lookarounds but they will trivially reject. E.g. (?!b?)\w won't match any input strings.

The only way to fix empty lookarounds is to either remove them or to rewrite the lookaround expression to be non-empty.

🔧 Options

Nothing.

🚀 Version

This rule was introduced in eslint-plugin-regexp v0.1.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