Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.1 KB

no-empty-capturing-group.md

File metadata and controls

51 lines (35 loc) · 1.1 KB
pageClass sidebarDepth title description since
rule-details
0
regexp/no-empty-capturing-group
disallow capturing group that captures empty.
v0.12.0

regexp/no-empty-capturing-group

💼 This rule is enabled in the ✅ plugin:regexp/recommended config.

disallow capturing group that captures empty.

📖 Rule Details

This rule reports capturing group that captures assertions.

/* eslint regexp/no-empty-capturing-group: "error" */

/* ✓ GOOD */
var foo = /(a)/;
var foo = /a(?:\b)/;
var foo = /a(?:$)/;
var foo = /(?:^)a/;
var foo = /(?:^|b)a/;

/* ✗ BAD */
var foo = /a(\b)/;
var foo = /a($)/;
var foo = /(^)a/;

🔧 Options

Nothing.

🚀 Version

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

🔍 Implementation