长字串.replace(/(<td\s+nowrap="nowrap"\s+id='regx'>)\d+(<\/td>)/gi,"$1"+想换的值+"$2")
上边的语句会返回已替换过的字串
<SCRIPT LANGUAGE="JavaScript"><!--
var a="fsfsd<img src='images/01.gif'>fsfsdf<img src='images/02.gif'>fsfsdf"
var regexp=new RegExp(/\w+(<\s*img\s*[^>]*>)\w+(<\s*img\s*[^>]*>)\w+/g)
regexp.exec(a)
a=a.replace(RegExp.$1,"#1")
a=a.replace(RegExp.$2,"#2")
alert(a)
//-->
</SCRIPT>
var s="<span>a</span>.... <span>z</span>"s=s.replace(/<span>(.*?)<\/span>/g,"<input type='text' value='$1' />")