DEV Community

Discussion on: Why is my regex working intermittently?

Collapse
 
brendanwilding profile image
brendanwilding

Life saver, thanks!

Minor typo in your example (regex2 should be regex?)

const regex = /a/gi // const regex = RegExp('a', 'gi')
regex2.test("abc") // --> true
regex2.test("abc") // --> false
regex2.test("abc") // --> true

Collapse
 
dvddpl profile image
Davide de Paolis

thanks! fixed!