Skip to content


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

🔧 This rule is automatically fixable by the --fix CLI option.

disallow missing g flag in patterns used in String#matchAll and String#replaceAll

📖 Rule Details

When calling String#matchAll() and String#replaceAll() with a RegExp missing the global (g) flag, it will be a runtime error. This rule reports RegExps missing the global (g) flag that cause these errors.

Now loading...

🔧 Options

  "regexp/no-missing-g-flag": ["error",
      "strictTypes": true
  • strictTypes ... If true, strictly check the type of object to determine if the regex instance was used in matchAll() and replaceAll(). Default is true.
    This option is always on when using TypeScript.

📚 Further reading

🚀 Version

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

🔍 Implementation