日期:2014-05-16  浏览次数:20357 次

求一表达式去除特定内容.
<form   name= "searchForm "   method= "post "   action= "JavaScript:checkInput() ">
内容长度不定
</form>


其中 <form   name= "searchForm "   method= "post "   action= "JavaScript:checkInput() "> 这格式固定.

把整个form的内容全部去除了.

------解决方案--------------------
<script>
var str = 'aaa <form name= "searchForm " method= "post " action= "JavaScript:checkInput() "> 内 <asiwasoa> <html> <td> /edwdsa定 </form> cccc ';
str=str.replace(/ <form name=\ "searchForm\ " method=\ "post\ " action=\ "JavaScript:checkInput\(\)\ "[\s\S]*? <\/form> /gi, " ");
alert(str);
</script>

------解决方案--------------------
<form name=\ "searchForm\ " method=\ "post\ " action=\ "JavaScript:checkInput\(\)\ "> [\s|\S]*? <\/form>