布尔值(True 或 False),用于指定正则表达式是否应不区分大小写。
Note:
默认值为 False。
设置属性用法:
语法:Object.IgnoreCase= "<True/False>"
Dim regex, inputText
' Create a new RegExp object
Set regex = CreateObject("VBScript.RegExp")
' Set the pattern and ignore case
regex.Pattern = "apple" ' Pattern to match the word 'apple'
regex.IgnoreCase = True ' Ignore case when matching
' Input text
inputText = "I ate an AppLe today."
' Test if the pattern matches the input text
If regex.Test(inputText) Then
'Match found Logic
Else
'No match found Logic
End If
Test 方法检查模式是否与字符串匹配,并返回 True,因为它在文本中找到 AppLe,即使它们的大小写不同。IgnoreCase = True 设置有助于以不区分大小写的方式搜索字符串。如果为 IgnoreCase = False,则 Test 方法将严格搜索字符串 apple 并返回 False,因为 apple 在 inputString 中不可用。