Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript use variable regex

// CREATE A REGEXP object
var replace = "regex";
var re = new RegExp(replace,"g");
//then use
"mystring".replace(re, "newstring")
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #variable #regex
ADD COMMENT
Topic
Name
6+8 =