繁体   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