我是靠谱客的博主 纯真诺言,这篇文章主要介绍VBS教程:对象-正则表达式(RegExp)对象,现在分享给大家,希望可以做个参考。

正则表达式(RegExp)对象

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

说明

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

复制代码
1
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教程内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(154)

评论列表共有 0 条评论

立即
投稿
返回
顶部