I have this expression to check wether if a key exists in a url :
new RegExp('/'+x+'/ig')
(removed the irrelevant code)
Thing is, it isn’t working. I suppose I have to use delimiters (start and end) to work, since the url has many other things, but not sure how to do it.
Any thoughts?
When you use
new Regex(), you have to pass the flags as a second parameterNote that you don’t need the literal delimiters when you create a
RegExpthis way