📜  重置正则表达式 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:40.928000             🧑  作者: Mango

代码示例1
// A JavaScript RegExp object is stateful.
// When the regex is global, if you call a method on the same regex object, it will start from the index past the end of the last match.
// When no more matches are found, the index is reset to 0 automatically.

reg.lastIndex = 0;