# regexp/prefer-predefined-assertion

prefer predefined assertion over equivalent lookarounds

  • ⚙️ This rule is included in "plugin:regexp/recommended".
  • 🔧 The --fix option on the command line (opens new window) can automatically fix some of the problems reported by this rule.

# 📖 Rule Details

All predefined assertions (\b, \B, ^, and $) can be expressed as lookaheads and lookbehinds. E.g. /a$/ is the same as /a(?![^])/.

In most cases, it's better to use the predefined assertions because they are better known.

Now loading...

# 🔧 Options


# 🚀 Version

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

# 🔍 Implementation

Last Updated: 6/25/2022, 12:32:38 PM