1. 获得多次匹配的次数和结果:
reg2 = /([0-9 ]+)[\r\n ]*/g;
rows=str.match(reg2);
if(rows)
alert(rows.length+"行");
2. 获得多个子匹配结果:
reg = /([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)[\r\n ]+([0-9 ]+)/g;
rows=reg.exec(str);
if(rows)
alert(rows.length+"行");