I'm looking to replace string with variable in regex.
re = new RegExp(/(?:^|\b)(asd)(?=\b|$)/, 'g')
After i get re
i replace it and it works but this is limited to asd
string.
How can i put variable d
in place of asd
string?
I tried following:
re = new RegExp('(?:^|\b)(' + d + ')(?=\b|$)', 'g')
But it didn't work, any help is appreciated. (I'm Using CoffeeScript)