Enforce RegExp#exec over String#match if no global flag (/g) is provided.
// code-linter.json5
{
"rules": {
"@typescript-eslint/prefer-regexp-exec": "error"
}
} /thing/.exec('something');
'some things are just things'.match(/thing/g);
const text = 'something';
const search = /thing/;
search.exec(text); 'something'.match(/thing/); 'some things are just things'.match(/thing/); const text = 'something'; const search = /thing/; text.match(search);
plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.