if you use new RegExp it will be that that will put the / in the regular expression
if you do
let re = new RegExp(<a>, <b>);
it creates a regular expression like /<a>/<b>
Please note that you still need to consider the general escaping rules for strings, for example if you want a backslash in the string you need to escape it and so write \\