📜  是正则表达式末尾所需的 g - Javascript 代码示例

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

代码示例1
// the 'g' means a global search will be used
> 'aaa'.match(/a/g)
[ 'a', 'a', 'a' ]

// here, without the g, the expression only matches once
> 'aaa'.match(/a/)
[ 'a', index: 0, input: 'aaa' ]