晕。过滤这样的字符怎么写正则?

bnabinge 2010-01-06 12:30:27
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />我要过滤 这类型的全部代码
怎么写正则?
...全文
43 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bnabinge 2010-01-06
  • 打赏
  • 举报
回复
呵呵。你的代码。给我了我写了第二个的过滤。呵呵。
yan11cn 2010-01-06
  • 打赏
  • 举报
回复
以下代码测试通过:

<%
dim str,reg
set reg = New RegExp
reg.Global=true
reg.Pattern="(<\?xml.*?\/>)"
reg.IgnoreCase = false
str="<?xml:namespace prefix = o ns = ""urn:schemas-microsoft-com:office:office"" />哈哈<?xml:namespace prefix = o ns = ""urn:schemas-microsoft-com:office:office"" />"
str=trim(str)
do while reg.Execute(str).count <> 0
str=reg.Replace(str,"")
loop
response.write(str)
%>
bnabinge 2010-01-06
  • 打赏
  • 举报
回复
还有 <o:p></o:p> 标签。我用下面的正则怎么过滤不了。
哪时错了啊
Function LoseOPTag(ContentStr)
Dim ClsTempLoseStr,regEx
ClsTempLoseStr = Cstr(ContentStr)
Set regEx = New RegExp
regEx.Pattern = "<(\/){0,1}o:p[^<>]*>"
regEx.IgnoreCase = True
regEx.Global = True
ClsTempLoseStr = regEx.Replace(ClsTempLoseStr,"")
LoseOPTag= ClsTempLoseStr
Set regEx = Nothing
End Function
tikecoke 2010-01-06
  • 打赏
  • 举报
回复
登入了看不到,上面写着要登入才能看,回贴了才看到。晕啊····
tikecoke 2010-01-06
  • 打赏
  • 举报
回复
为什么我看不到2楼的回复?
文盲老顾 2010-01-06
  • 打赏
  • 举报
回复

Function RegReplace(vStr,vReg,vCode)
Dim Re,sStr
sStr = vStr
Set Re = New RegExp
Re.Pattern = vReg
Re.IgnoreCase = True
Re.Global = True
If Re.Test(sStr) Then
sStr = Re.Replace(sStr,vCode)
End If
RegReplace = sStr
End Function


问题是我没看明白你要把什么过滤掉

28,391

社区成员

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

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