how do you insert a variable in regex js code example
Example: add variable inside regex in javascript
var pattern="cd"
var repeats=3
new RegExp(`${pattern}{${repeats}}`, "g")
var pattern="cd"
var repeats=3
new RegExp(`${pattern}{${repeats}}`, "g")