Skip to content


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

🔧💡 This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.

disallow multi-code-point characters in character classes and quantifiers

📖 Rule Details

This rule reports misleading Unicode characters.

Some Unicode characters like '❇️', '🏴‍☠️', and '👨‍👩‍👦' consist of multiple code points. This causes problems in character classes and around quantifiers. E.g.

> /^[❇️🏴‍☠️]$/.test("🏴‍☠️")
> /^👨‍👩‍👦{2,4}$/.test("👨‍👩‍👦👨‍👩‍👦")

This rule is inspired by the no-misleading-character-class rule.

Now loading...

🔧 Options

  "regexp/no-unused-capturing-group": ["error", {
    "fixable": true
  • fixable: true | false

    This option controls whether the rule is fixable. Defaults to false.

    This rule is not fixable by default. Misleading Unicode characters can typically be fixed automatically by assuming that users want to treat one displayed character as one regex character. However, this assumption is not useful in all languages, so this rule provides suggestions instead of fixes by default.

📚 Further reading

🚀 Version

This rule was introduced in eslint-plugin-regexp v1.2.0

🔍 Implementation