I'm trying to return how many times the string s.t()
was found in a string, but I can't get the correct regex for this...
For example
var string = 'function(test) {s.t(); s.t(dsabf); s.t();}'
var re = new RegExp('s\.t\(\)', "g");
return re;
should return an array of 2 elements ['s.t()', 's.t()']
but instead it has 3 elements ['s.t', 's.t', 's.t']
I've also tried with ^s\t\(\)$
but this returns no match...
How can I fix my regex in order to make this work as expected?