[Project_owners] regex help

Eric H. Jung grimholtz at yahoo.com
Tue Apr 18 16:52:02 EDT 2006


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


More information about the Project_owners mailing list