69
rated 0 times
[
73]
[
4]
/ answers: 1 / hits: 89443
/ 14 Years ago, wed, march 2, 2011, 12:00:00
I am trying to create something similar to this:
var regexp_loc = /e/i;
except I want the regexp to be dependent on a string, so I tried to use new RegExp but I couldn't get what i wanted.
Basically I want the e
in the above regexp to be a string variable but I fail with the syntax.
I tried something like this:
var keyword = something;
var test_regexp = new RegExp(/ + keyword + /i);
Basically I want to search for a sub string in a larger string then replace the string with some other string, case insensitive.
regards,
alexander
More From » regex