📅  最后修改于: 2022-03-11 15:03:05.209000             🧑  作者: Mango
// CREATE A REGEXP object
var replace = "regex";
var re = new RegExp(replace,"g");
//then use
"mystring".replace(re, "newstring")