Regular expressions in JS

why do I have to use global flag when using / \w / expression. It’s shorthand of this right? / [ A-Za-z0-9_ ] /

And I’m also curious about this underscore. what does that mean?
thanks guys!

you don’t have to use global flag, depends on your use case.
underscore is part of \w (words), so if you don’t want it you can remove it

1 Like