loading...

re: How YOU can learn enough RegEx in JavaScript to be dangerous VIEW POST

FULL DISCUSSION
 

I know that pain (and I've bookmarked this article for the next time I feel it!)

The only thing I'd point out is that in your example of making a regex at the top using the constructor you are using a regex as the parameter - I'd say the real benefit of the constructor version is that it can take a plain string - not only an existing regex. Also it's new RegExp() in JS.

     const myRegex = new RegExp(`(${magicWord})|(blah)`, 'i')
 

hi Mike. Thanks for the feedback.. Yea definitly, it needs escape signs though, so it's not 1-1 replacement. I learned that the hard way :)

 
code of conduct - report abuse