1
我有這樣的一段文字中的字符串:刪除回車用正則表達式
<p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"><i style=""><span style="" lang="ES-TRAD">some text
another text<o:p></o:p></span></i></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; text-align: center; line-height: normal;" align="center"><i style=""><span style="" lang="ES-TRAD">some text more
and some text more<o:p></o:p></span></i></p>
如果我做
string.replace(/[\r\n]/g, "");
所有回車將被刪除,我只是想刪除那些介於「某些文本」和「另一文本」之間的人,我的意思是在這些跨度內。
在此先感謝。
你知道[你不能用正則表達式解析HTML](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/ 1732454#1732454),對吧? – 2010-08-11 04:12:11
但是,當然,您可以使用不規則表達式解析HTML! – 2010-08-11 04:15:34
@Daniel Pryden:不,不過謝謝。 – santiagokci 2010-08-11 04:22:58