征求更好的实现方法...
需求:
??? 格式:123abc,2011-09-08 11:22;456abc,2011-09-08 11:22;8&%$#,2011-09-08 11:22;una89,2011-09-08 11:22;.....(很多很多...)
??? 输出:123abc|456abc|&%$#|una89
我的实现方法如下,欢迎大家贴出好的想法
var str="123abc,2011-09-08 11:22;456abc,2011-09-08 11:22;8&%$#,2011-09-08 11:22;una89,2011-09-08 11:22;";
var re=/([^,]*),([^;]*);/g,txt,rs=[];
while((txt=re.exec(str))!=null){
????rs.push(txt[1]);
}
alert(rs.join("|"));
?