ignorecase 属性
设置或返回一个boolean值,指明模式搜索是否区分大小写。
object.ignorecase [= true | false ]
object 参数总是一个 regexp 对象。如果搜索是区分大小写的,则 ignorecase 属性为 false;否则为 true。缺省值为 false。
说明
下面的代码说明了 ignorecase 属性的用法(改变赋予 ignorecase 属性的值以观察其效果):
function regexptest(patrn, strng)
dim regex,match,matches ' 建立变量。
set regex = new regexp ' 建立正则表达式。
regex.pattern = patrn ' 设置模式。
regex.ignorecase = true ' 设置不区分大小写。
regex.global=true ' 设置全局可用性
set matches=regexexecute(string ) ' 执行搜索。
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"))