Construct a regular expression from a string, useful for searching:
js
var term = "ma";
var regExp = new RegExp(term, "gi"); // global search, case insensitive
regExp.test("Madonna"); // true
29 October 2014
Construct a regular expression from a string, useful for searching:
var term = "ma";
var regExp = new RegExp(term, "gi"); // global search, case insensitive
regExp.test("Madonna"); // true