I am reading about RegExp. I have a small problem with me now
var text = "cat, bat, fat";
var pattern = /.at/gi;
var matches = pattern.exec(text);
By executing this for the first time I am getting only one match that is cat when i execute the second time i am getting bat. I have specified the global flag but till its giving only one at a time.Am i specifying it wrongly or thats the way regexp works?
Try this: