内容显示页
 
类别:JavaScript | 浏览(273) | 2007-2-6 15:36:00

Function RegExpTest(patrn, strng)
  Dim regEx, Match, Matches      ' 建立变量。
  Set regEx = New RegExp         ' 建立正则表达式。
  regEx.Pattern = patrn         ' 设置模式。
  regEx.IgnoreCase = True         ' 设置是否区分字符大小写。
  regEx.Global = True         ' 设置全局可用性。
  Set Matches = regEx.Execute(strng)   ' 执行搜索。
  For Each Match in Matches      ' 遍历匹配集合。
    RetStr = RetStr & "Match found at position "
    RetStr = RetStr & Match.FirstIndex & ". Match Value is '"
    RetStr = RetStr & Match.Value & "'." & vbCRLF
  Next
  RegExpTest = RetStr
End Function
MsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))

 

function getimg(str)
 Set re = new RegExp
 re.Pattern = "\<img(.+?)src\=([^\s]+?)(\s|\>)"
 re.Global = True
 re.IgnoreCase = false
 re.MultiLine = false
 Set  rv = re.Execute(str)
 For Each Match in rv   ' 遍历匹配集合。
      g=g+Match.SubMatches(1)+"|"
   Next
   getimg=g
end function
str="<img src=""dsafdsafasfd"" ...><img src=""dsafdsafasfd"" ...><img src=""dsafdsafasfd"" ...><img src=""dsafdsafasfd"" ...>"
msgbox getimg(str)


引用本页地址:http://www.yongfa365.com/item/28bd0613116f11f4.html
 
 
相关链接
 
网友评论:
姓名: 记住我
网址:
邮箱:
内容:
验证码:  验证码图片 看不清? 换张图试试
 
     
 
 
文章分类
 
 
.Net + C#(73)
 
 
ASP+VBS(161)
 
 
 
Linux(10)
 
 
 
web 2.0(26)
 
 
 
 
 
心程(68)
 
生活(97)
 
 
     

Power by :柳永法(yongfa365)'Blog  | 京ICP备07011491号  QQ:64049027  E-mail:64049027@qq.com yongfa365'CodePlex yongfa365'CodeGoogle

申请友情链接 要求:跟本站主题相类似正规网站,双方交换为首页位置

转载请注明来源,以便后人及时得到最新、修正、加强版!!!