87,984
社区成员
发帖
与我相关
我的任务
分享var str="第<SPAN id=topic_1>1</SPAN>题:第<SPAN id=topic_2>1</SPAN>题:第<SPAN id=topic_4>1</SPAN>题:"
var nums=['零','一','二','三','四','五','六','七','八','九','十']
str=str.replace(/<SPAN id=topic_(\d)+>.*?<\/SPAN>/ig,function(s){s=s.match(/id=topic_(\d)+>/i);return nums[parseInt(s[1],10)]; });
alert(str);
str="html htmlhtmlhtml<DIV class=tChange>"
str=str+"<DIV onclick=switchTflag(1,1); class=first></DIV>"
str=str+"<DIV onclick=switchTflag(1,1); class=previous></DIV>"
str=str+"<DIV onclick=switchTflag(1+1,1); class=next></DIV>"
str=str+"<DIV onclick=switchTflag(70,4); class=last></DIV>"
str=str+"</DIV>替换"
alert(str.replace(/<DIV class=tChange>[\d\D]*?<\/DIV>\s*<\/DIV>/i,""))