There is a block div, in him an unknown number of links like "a href onclick", if there are link more one, then they are separated a comma and a space.
var reg = /<div class="labeled fl_l"><a href="[^"]*" onclick="[^"]*">(.+?)<\/a>(, <a href="[^"]*" onclick="[^"]*">(.+?)<\/a>{1,})?<\/div>/mg;
var arr;
while ((arr = reg.exec(data)) != null) {
console.log(arr[0]); //contains the entire text (because it is java script)
console.log(arr[1]); //contains the name of the first link
console.log(arr[2]); //contains the following "a href" entirely (if I will point out (?: x, <a... /a>), then the nested brackets will not work)
console.log(arr[3]); //contains the name of the second link, **and then all of the code**
}
}
I think that should be used ([^ <] *)
instead of (. +?)
, but it does not work at all then.