請,我需要一個正則表達式來刪除所有表單標籤。 例如,如果在HTML文本我有:正則表達式刪除所有輸入/ textarea /選擇從html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title appears in the browser's title bar...</title>
<style type="text/css">
body {background-color:ffffff;background-image:url(http://);background-repeat:no-repeat;background-position:top left;background-attachment:fixed;}
h1{font-family:Cursive;color:000000;}
p {font-family:Cursive;font-size:14px;font-style:normal;font-weight:normal;color:000000;}
</style>
</head>
<body>
<form name="fr">
<input name="ss" id="sss" value="as1">
</form>
<h1>Heading goes here...</h1>
<p>Enter your paragraph text here...</p>
</html>
我需要刪除所有輸入標籤獲得:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title appears in the browser's title bar...</title>
<style type="text/css">
body {background-color:ffffff;background-image:url(http://);background-repeat:no-repeat;background-position:top left;background-attachment:fixed;}
h1{font-family:Cursive;color:000000;}
p {font-family:Cursive;font-size:14px;font-style:normal;font-weight:normal;color:000000;}
</style>
</head>
<body>
<form name="fr">
</form>
<h1>Heading goes here...</h1>
<p>Enter your paragraph text here...</p>
</html>
_where是我噴bottle_ ...... [正則表達式匹配開放標籤的可能重複除XHTML獨立標籤](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags)。順便說一句,當問正則表達式問題時,你應該指定編程語言。 – 2011-03-11 18:33:54
「我需要一個正則表達式來刪除所有表單標籤」 - 不,你需要一個HTML解析器,正如Matt的鏈接中所解釋的 – 2011-03-12 05:53:54
你正在使用哪種正則表達式? – ridgerunner 2011-03-12 07:20:58