var temp = "This is a string.";console.log((temp.match(new RegExp("is", "g")) || []).length);
↧
Answer by Sunil Garg for How to count string occurrence in string?
↧
var temp = "This is a string.";console.log((temp.match(new RegExp("is", "g")) || []).length);