# regexp/prefer-regexp-exec
enforce that
RegExp#exec
is used instead ofString#match
if no global flag is provided
RegExp#exec
is faster than String#match
and both work the same when not using the /g
flag.
# 📖 Rule Details
This rule is aimed at enforcing the more performant way of applying regular expressions on strings.
This rule inspired by @typescript-eslint/prefer-regexp-exec rule (opens new window).
# 🔧 Options
Nothing.
# 📚 Further reading
# 🚀 Version
This rule was introduced in eslint-plugin-regexp v0.3.0