RsD0p9BK
3/13/2015 - 5:40 AM

regexp_var.js

// Variable to a Regular Expression

var re = new RegExp("regex", "g");
str.replace(re, "newstring");

// http://stackoverflow.com/questions/494035/how-do-you-pass-a-variable-to-a-regular-expression-javascript