I have html code and I want to remove all code inside "pre" tag using regular expression
For example
<pre>lorem ipsum</pre>
<p><strong>lorem ipsum</p>
<pre>lorem ipsum</pre>
and I want to get only
<p><strong>lorem ipsum</p>
I try this:
<pre>.*?</pre>
but it doesn't work
答案 0 :(得分:0)
一个简单的有趣的Javascript清洁前:
var pres = document.querySelectorAll('pre');
for(var i in pres){
pres[i].textContent = "";
}
&#13;
pre{
text-align: center;
background-color: #cccccc;
border-radius: 8px;
width:100%;
height:50px;
}
&#13;
<pre>lorem ipsum</pre>
<p><strong>lorem ipsum</p>
<pre>lorem ipsum</pre>
&#13;