帮忙写一个正则式

lhb2000 2010-04-14 02:36:11
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; LINE-HEIGHT: 25pt; mso-line-height-rule: exactly; mso-char-indent-count: 1.8"><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: BatangChe; mso-hansi-font-family: BatangChe">观赏型花卉生态园</SPAN><SPAN lang=EN-US style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-hansi-font-family: 华文中宋"><o:p></o:p></SPAN></P>
如何将上面的通过正则式换成
<SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: BatangChe; mso-hansi-font-family: BatangChe">观赏型花卉生态园</SPAN><SPAN lang=EN-US style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-hansi-font-family: 华文中宋"><o:p></o:p></SPAN>
就是 只取<p XX></p>中间的东东
...全文
83 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
sabyt1 2010-04-14
  • 打赏
  • 举报
回复
MARK
t122 2010-04-14
  • 打赏
  • 举报
回复

<%
Dim ss, re, rv
ss = "<P class=MsoNormal style='MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; LINE-HEIGHT: 25pt; mso-line-height-rule: exactly; mso-char-indent-count: 1.8'><SPAN style='FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: BatangChe; mso-hansi-font-family: BatangChe'>观赏型花卉生态园</SPAN><SPAN lang=EN-US style='FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-hansi-font-family: 华文中宋'><o:p></o:p></SPAN></P>"
Set re = New RegExp
re.Pattern = "<\/?P[^>]*>"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
rv = re.Replace(ss,"")
response.write rv
%>
t122 2010-04-14
  • 打赏
  • 举报
回复
<%
Dim ss, re, rv
ss = "<P class=MsoNormal style='MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; LINE-HEIGHT: 25pt; mso-line-height-rule: exactly; mso-

char-indent-count: 1.8'><SPAN style='FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: BatangChe; mso-hansi-font-

family: BatangChe'>观赏型花卉生态园</SPAN><SPAN lang=EN-US style='FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-hansi-font-

family: 华文中宋'><o:p></o:p></SPAN></P>"
Set re = New RegExp
re.Pattern = "<\/?P[^>]*>"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
rv = re.Replace(ss,"")
response.write rv
%>
yan11cn 2010-04-14
  • 打赏
  • 举报
回复

<%
Dim str,reg
str="fmogj<p class=MsoNormal style=""MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; LINE-HEIGHT: 25pt; mso-line-height-rule: exactly; mso-char-indent-count: 1.8"">哈哈哈</p>dfnei<p>你好</p>gg "
set reg = New RegExp
reg.Global=true
reg.Pattern="<p.*?>([\W\w]*?)<\/p>"
reg.IgnoreCase = True
Set matches=reg.execute(str)
For Each match In matches
response.write match.submatches(0) & "<br />"
Next
%>
t122 2010-04-14
  • 打赏
  • 举报
回复
==,我调试个正确的给你
lhb2000 2010-04-14
  • 打赏
  • 举报
回复
有asp代码吗?
t122 2010-04-14
  • 打赏
  • 举报
回复

var html = '<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-INDENT: 27pt; LINE-HEIGHT: 25pt; mso-line-height-rule: exactly; mso-char-indent-count: 1.8"><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-ascii-font-family: BatangChe; mso-hansi-font-family: BatangChe">观赏型花卉生态园</SPAN><SPAN lang=EN-US style="FONT-SIZE: 15pt; FONT-FAMILY: 仿宋_GB2312; mso-hansi-font-family: 华文中宋"><o:p></o:p></SPAN></P>';
html = html.replace(/<\/?P[^>]*>/gi, "" );
alert(html);//弹出转换结果,不需要可注释掉

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧