测试字符串:

<style>v\:* { 
BEHAVIOR: url(#default#VML) 
} o\:* 
{ 
BEHAVIOR: url(#default#VML) 
} w\:*
{ 
BEHAVIOR: url(#default#VML) 
} 
.shape 
{ 
BEHAVIOR: url(#default#VML) 
}
</style> 
abcdefg 
<style>
@font-face 
{ 
font-family: Wingdings;
} 
@font-face
{ 
font-family: Wingdings; 
} 
@font-face
{ 
font-family: Calibri;
} @font-face 
{ 
font-family: Tahoma; 
} 
@page WordSection1 
{size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; 
} P.MsoNormal 
{ 
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; 
FONT-FAMILY: "Times New Roman","serif" 
} LI.MsoNormal { 
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif" 
} DIV.MsoNormal 
{ 
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif" 
} 
H1 
{ 
FONT-WEIGHT: bold; FONT-SIZE: 24pt; MARGIN-LEFT: 0in; 
MARGIN-RIGHT: 0in;
FONT-FAMILY: "Times New Roman","serif";
mso-style-priority: 9; 
mso-style-link: "Heading 1 Char"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
A:link 
{ 
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
} 
SPAN.MsoHyperlink
{ 
COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99 
} A:visited 
{ 
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
} SPAN.MsoHyperlinkFollowed 
{ 
COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99 
} 
P 
{ 
FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: "Times New Roman","serif"; 
mso-style-priority: 99; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto 
}
P.MsoAcetate 
{ 
FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; 
mso-style-priority: 99; mso-style-link: "Balloon Text Char"
} 
LI.MsoAcetate
{ 
FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text Char"
} DIV.MsoAcetate 
{ 
FONT-SIZE: 8pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Tahoma","sans-serif";
mso-style-priority: 99; mso-style-link: "Balloon Text Char" 
} 
SPAN.Heading1Char 
{ 
FONT-WEIGHT: bold; mso-style-priority: 9; mso-style-link: "Heading 1"; mso-style-name: "Heading 1 Char" 
} 
SPAN.EmailStyle19 { 
COLOR: #1f497d; FONT-FAMILY: "Arial","sans-serif"; mso-style-type: personal-reply 
} SPAN.BalloonTextChar 
{ 
FONT-FAMILY: "Tahoma","sans-serif"; mso-style-priority: 99; mso-style-link: "Balloon Text"; mso-style-name: "Balloon Text Char" 
} 
.MsoChpDefault { 
FONT-SIZE: 10pt; mso-style-type: export-only 
} DIV.WordSection1 { 
page: WordSection1 } OL 
{ 
MARGIN-BOTTOM: 0in } UL 
{ 
MARGIN-BOTTOM: 0in 
}
</style>

第一次尝试:<style[^>/]*>(.*"htmlcode">

var result= testData.replace(<style(([\s\S])*"htmlcode">
var result= testData.replace(/<style(([\s\S])*?)<\/style>/g, '');

g:代表可以进行全局匹配。

i:代表不区分大小写匹配。

m:代表可以进行多行匹配。

以上内容是小编给大家介绍的JavaScript正则表达式匹配<div><style>标签,希望对大家有所帮助!

标签:
正则表达式匹配style,正则表达式匹配div,javascript正则表达式

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com

评论“JavaScript正则表达式匹配 div  style标签”

暂无“JavaScript正则表达式匹配 div  style标签”评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。