页面导航: 首页脚本专栏vbs → 正文内容

VBS教程:对象-正则表达式(RegExp)对象

发布:dxy 字体:[增加 减小] 类型:转载

正则表达式(RegExp)对象

提供简单的正则表达式支持功能。

说明

下面的代码说明了RegExp对象的用法:

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 = RetStrEnd FunctionMsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))
浏览次数:载入中... 打印本文关闭本文文章来源
·在百度中搜索关于“VBS教程:对象-正则表达式(RegExp)对象”相关内容
·在谷歌中搜索关于“VBS教程:对象-正则表达式(RegExp)对象”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行