looks like they're all separated by ";" - if that's the case I'd simply
split the string:
var proxylst = proxystr.split(';');
for (var i in proxylst) {
... do whatever for single proxy ...
}
If this doesn't help, you may need to cut the string after each regex action
also, why do you have "\d*"? the way your regex works, it'll expect the
format to be "PROXY asdf.asdf.com:; SOCKS asdf.asdf.com:" when there's
no port specified. if it's always specified, then you should change * to
+. If not, then you need to make the ":" optional along with the rest,
e.g. "(:(\d+))?"
HTH,
Konstantin
Eric H. Jung wrote:
Hi,
I'm trying to write a regex which parses 3 pieces of data multiple times. For
example:
PROXY w3proxy.netscape.com:8080
or
PROXY mozilla.netscape.com:8081;PROXY w3proxy.netscape.com:8080
or
PROXY mozilla.netscape.com:8081; SOCKS w3proxy.netscape.com:444;DIRECT
The following works but only keeps the last match set:
var re = /\s*(\S+)\s+(\S+):(\d*)\s*[;]?\s*/g;
In other words:
var a = re.exec("PROXY w3proxy.netscape.com:8080; SOCKS moofarm.com:1234");
a[1] = "SOCKS";
a[2] = "moofarm.com";
a[3] = "1234";
but I also want:
a[x] = "PROXY ";
a[y] = "w3proxy.netscape.com";
a[z] = "8080";
Any advice is greatly appreciated.
Thank you,
Eric Jung
Use Your PC To Find a Cure for
Cancerhttp://members.ud.com/services/teams/team.htm?id=68C9E079-8285-495F-8598-D73352CC7075And
Join Team Lulu
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners