当前位置: 首页 > 图文教程 > 脚本技术 > VBScript > VBS教程:VBscript属性-Global 属性

VBScript
VBS教程:方法-GetDrive 方法
VBS教程:方法-GetBaseName 方法
VBS教程:方法-GetAbsolutePathName 方法
VBS教程:方法-FolderExists 方法
VBS教程:方法-FileExists 方法
VBS教程:方法-Exists 方法
VBS教程:方法-DriveExists 方法
VBS教程:方法-DeleteFolder 方法
VBS教程:方法-DeleteFile 方法
VBS教程:方法-Delete 方法
VBS教程:方法-CreateTextFile 方法
VBS教程:方法-CreateFolder 方法
VBS教程:方法-CopyFolder 方法
VBS教程:方法-CopyFile 方法
VBS教程:方法-Copy 方法
VBS教程:方法-Close 方法
VBS教程:方法-BuildPath 方法
VBS教程:方法-AddFolders 方法(Folders)
VBS教程:方法-Add 方法(Dictionary)
VBS教程:VBScript 语句-With 语句

VBScript 中的 VBS教程:VBscript属性-Global 属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 48 ::
收藏到网摘: n/a

Global 属性

设置或返回一个 Boolean 值,该值指明在整个搜索字符串时模式是全部匹配还是只匹配第一个。

object.Global [= True | False ]

对象 参数总是 RegExp 对象。如果搜索应用于整个字符串,Global 属性的值为 True,否则其值为 False。默认的设置为 False

说明

下面的代码说明了 Global 属性的用法(改变赋予 Global 属性的值并观察其效果):

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 NextRegExpTest=RetStrEnd FunctionMsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))