$ 0 0 Simple version without regex:var temp = "This is a string.";var count = (temp.split('is').length - 1);alert(count);