asp提取媒体文件并清理播放器代码

'进行多媒体对象检测
 '提取媒体文件,清理播放器
 Function CheckMedia(Content)
  Dim oregExp,oRegExp1,oMatch,Matches,oMatch1,Matches1
  Dim sFiles1,sFiles2,sFile
  sFiles="swf,mp3,rm,ram,rmvb,mp4,wma,wav,avi"
  Set oregExp = New Regexp
  oRegExp.IgnoreCase = True
  oRegExp.Global = True
  Set oregExp1 = New Regexp
  oRegExp1.IgnoreCase = True
  oRegExp1.Global = True

  '媒体文件
  oRegExp.pattern ="<object.+?>"
  Set Matches=oRegExp.Execute(Content)
  For Each oMatch In Matches
   oRegExp1.pattern="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
   Set Matches1=oRegExp.Execute(oMatch.Value)
   For Each oMathch1 In Matches1
    '只取媒体文件
    sFile=Split(oMathch1.value,".")
    If InStr(sFiles1,sFile(UBound(sFile)))>0 Then
     strFiles2="<a href=""" &  oMathch1.value & """ target=""_blank"">" & oMathch1.value & "</a><br>"
    End If
   Next
  Next
  '清空
  oRegExp.pattern ="<object.+?/object>"
  Content=oRegExp1.replace(Content,"")
  oRegExp.pattern ="<em.+?>"
  Set Matches=oRegExp.Execute(Content)
  For Each oMatch In Matches
   oRegExp1.pattern="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"
   Set Matches1=oRegExp.Execute(oMatch.Value)
   For Each oMathch1 In Matches1
    '只取媒体文件
    sFile=Split(oMathch1.value,".")
    If InStr(sFiles1,sFile(UBound(sFile)))>0 Then
     strFiles2="<a href=""" &  oMathch1.value & """ target=""_blank"">" & oMathch1.value & "</a><br>"
    End If
   Next
  Next
  oRegExp.pattern ="<em.+?/em>"
  Content=oRegExp1.replace(Content,"")
  Set oregExp1=othing
  Set oregExp2=othing
 End Function



上一篇: asp新建文本文件并写入内容
下一篇: asp判断客户端操作系统及浏览器
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: asp
相关日志:
评论: 0 | 引用: 0 | 查看次数: 3155
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭

 广告位

↑返回顶部↑