How do i pass a variable in regex

Anytime you use a special meta character like \s or \w or \b, you must add the extra backslash for the string version of the regular expression to work with RegExp.

In regular expressions, the ** is an escape character in string literals, so you must escape the single ** with another \ so that the actual regular expression sees the single ** with the character that follows it.