Hey there I'm trying to write a multi-word RegEx that uses word boundaries. The string I'm searching is as follows (this is only a test string):
const regString = "/gamma/ truck?timer!doctor\\face"
Here is my regular expression:
const testReg2 = new RegExp("\\b\/gamma/|truck|\\?|face\\b", "gi");
For whatever reason the console posts ['truck', '?', 'face']
but it refuses to find '/gamma/' which is puzzling because const testReg = new RegExp("/gamma/");
does find '/gamma/'.
const regString = "/gamma/ truck?timer!doctor\\face"
const testReg2 = new RegExp("\\b\/gamma/|truck|\\?|face\\b", "gi");
console.log(regString.match(testReg2))