var str = 'the first 3 letters of the alphabet are abc. not abc123'; var pat = /(abc)/g; console.log(str.match(pat)); // ["abc"]