# regexp/prefer-regexp-test
enforce that
RegExp#test
is used instead ofString#match
andRegExp#exec
- 🔧 The
--fix
option on the command line (opens new window) can automatically fix some of the problems reported by this rule.
# 📖 Rule Details
This rule is aimed to use RegExp#test
to check if a pattern matches a string.
This rule inspired by unicorn/prefer-regexp-test rule (opens new window).
# 🔧 Options
Nothing.
# 📚 Further reading
# 🚀 Version
This rule was introduced in eslint-plugin-regexp v0.3.0