# regexp/no-misleading-unicode-character

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("🏳️‍🌈")
false
> /^👨‍👩‍👦{2,4}$/.test("👨‍👩‍👦👨‍👩‍👦")
false

This rule is inspired by the no-misleading-character-class (opens new window) 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