用於指定正規表示式是否不區分大小寫的布林值 (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 字串,並因 inputString 中沒有 apple 而傳回 False。