insert variable in regular expression javascript 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")