当前位置: 移动技术网 > IT编程>脚本编程>VBScript > VBS教程:VBscript属性-Global 属性

VBS教程:VBscript属性-Global 属性

2017年12月12日  | 移动技术网IT编程  | 我要评论

姬丽哈泽尔10分钟,接档醋娘子,幻影少年第二季

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"))

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网