RegExp:lastIndex

(標準組み込みオブジェクト > RegExp)
https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex

regExpObj.lastIndex

lastIndexは、読み込み/書き込みが可能な正規表現の数値プロパティで、 次のマッチが開始されるインデックスが指定されている。

const regex1 = new RegExp('foo', 'g');
const str1 = 'table football, foosball';

regex1.test(str1);
console.log(regex1.lastIndex);
>> 9

regex1.test(str1);
console.log(regex1.lastIndex);
>> 19
inserted by FC2 system