regex - How to get the second occurrence of a Regexp match in Javascript -
i want 2 string following url, first -43.575285
, second 172.762549
i wrote regexp pattern re = /-?\d+\.\d{6}/;
which works first value, there way matcher can continue search result string , give me second pattern occurrence?
p.s remember ruby has $1-$9
reference occurrence.
add g
flag end...
re = /-?\d+\.\d{6}/g;
this g
global.
var matches = str.match(re);
note won't work quite above if add capturing groups.
Comments
Post a Comment