showing results for - "is the g required at the end of a regex expression"
Maja
06 Feb 2017
1// the 'g' means a global search will be used
2> 'aaa'.match(/a/g)
3[ 'a', 'a', 'a' ]
4
5// here, without the g, the expression only matches once
6> 'aaa'.match(/a/)
7[ 'a', index: 0, input: 'aaa' ]
8
similar questions