使用正则表达式从段落的开头和结尾删除中断

时间:2012-07-16 22:06:08

标签: javascript html regex

我的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正则表达式。

1 个答案:

答案 0 :(得分:0)

如果恰好是5:

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