\\([0-9]{2})\\<\\/td\\>\\ | ([^\\<]+)\\<\\/td\\>\\ | ([0-9]+)\\<\\/td\\>\\<\\/tr\\>','g'); var fieldIndex = { 'Id' : 1 , 'Name' : 2 , 'Phone' : 3 } var g_records = [],record; while ((record = regRecord.exec(str)) != null){ g_records.push({ 'Id' : RegExp["$"+fieldIndex.Id] ,'Name' : RegExp["$"+fieldIndex.Name] ,'Phone' : RegExp["$"+fieldIndex.Phone] }); } //此时 g_records 就保存了匹配的数据表格,打印出来看看: for(var i=0;ialert("ID:" + g_records[i].Id + ";Name:" + g_records[i].Name + ";Phone:" + g_records[i].Phone); }
显示全文
|