pageClass | sidebarDepth | title | description | since |
---|---|---|---|---|
rule-details |
0 |
regexp/no-empty-capturing-group |
disallow capturing group that captures empty. |
v0.12.0 |
💼 This rule is enabled in the ✅ plugin:regexp/recommended
config.
disallow capturing group that captures empty.
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/;
Nothing.
This rule was introduced in eslint-plugin-regexp v0.12.0