加一个反扛跳转一下不就可以吗?<script>
var a="fdsafdsa<select>......</select>fdsafdasfdsaf";
alert(a.replace(/<select>.*<\/select>/i,"<此处内容被替换掉了>"));
</script>
var a="fdsafdsa<select>......</select>fdsafdasfdsaf";
alert(a.replace(/<select>.*<\/select>/i,"<此处内容被替换掉了>"));
</script>
a = "﹕<td><select>......</select></td>";
alert(a.replace(/(.*<td[^<]*>)(.+)(<\/td>.*)/,"$1新内容$3"));
</script>
正则表达式 /(.*<td[^<]*>)(.+)(<\/td>.*)/
其中:
(.*<td[^<]*>) 匹配标记<td>及以前的东西包括td的属性部分 $1
(<\/td>.*) 匹配标记</td> $3
(.+) 匹配<td></td>间的内容 $2
$i为被()括起部分的匹配内容,按括号顺序td间的内容可能是不确定的