peterschussheim
10/15/2016 - 5:58 PM

regex1

regex1

var str = `Is this This`;

// var regex = new RegExp("is");
var regex = /is/gi; ///Equivalent to above


regex.test(str);
regex.exec(str) ///Returns an object containing the matched expression, the index and the original input.

regex.exec(str)

str.match(regex)
str.replace(regex, str => "XX");

str.search(regex)

regex1

This Gist was automatically created by Carbide, a free online programming environment.

You can view a live, interactive version of this Gist here.