sonarjs/prefer-regexp-exec
eslint-plugin-sonarjs
SuggestionRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/prefer-regexp-exec": "error",
},
},
];"RegExp.exec()" should be preferred over "String.match()"
No code example for this rule
The linters' documentation does not include one we could extract.
sonarjs/prefer-regexp-exec
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/prefer-regexp-exec": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Prefer RegExp#exec() over String#match() for non-global regular expressions.
Enforce RegExp#exec over String#match if no global flag is provided
Return of boolean expressions should not be wrapped into an "if-then-else" statement
The most specific assertion should be used