簡體   English   中英

使用正則表達式刪除段落開頭和結尾的中斷

[英]Remove Breaks from start and end of the paragraph using Regular expression

我有我的html片段,如下所示


<B>Summary:</B><BR><BR><BR><BR><BR>
<P><BR><SPAN style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; LETTER-SPACING: normal; DISPLAY: inline !important; FONT: 13px Verdana, Arial, sans-serif; WHITE-SPACE: normal; ORPHANS: 2; FLOAT: none; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Web developer can also use Regular Expression in JavaScript. Now I describe some simple examples of using Regular Expression in JavaScript.</SPAN></P><BR>
<P><BR><A href="http://www.yahoo.com">www.yahoo.com</A></P><BR>
<P><BR><A href="http://www.orkut.com">www.orkut.com</A></P><BR><BR>

I want to remove all the <BR> tags between </B> and <P> tags(</B><BR><BR><BR><BR><BR> <P>)

如何使用javascript正則表達式來做到這一點。

如果正好是5:

var str = "<B>...";
str = str.replace(/(<BR>){5}/, '');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM