JavaScript RegExp Exec Method
exec[fn:exec] returns null if no match was found or an object with information about the match otherwise:
let match = /\d+/.exec("one two 100");
console.log(match);
console.log(match.index);See also
- [JavaScript RegExp Match Method](JavaScript RegExp Match Method)
Footnotes
[fn:exec]https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/RegExp/exec