Answers for "is the g required at the end of a regex expression"

0

is the g required at the end of a regex expression

// 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' ]
Posted by: Guest on May-28-2021

Code answers related to "is the g required at the end of a regex expression"

Code answers related to "Javascript"

Browse Popular Code Answers by Language