Propriedade IgnoreCase

Valor booliano (True ou False) que especifica se a expressão regular não deve fazer distinção entre maiúsculas e minúsculas.

Note:

O valor padrão é False.

Definir Uso da Propriedade:

Sintaxe: 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

O método Test verifica se o padrão corresponde à string, retornando True por localizar AppLe no texto, mesmo que as palavras estejam capitalizadas de forma diferente. A definição IgnoreCase = True ajuda a pesquisar a string sem distinção entre maiúsculas e minúsculas. Se IgnoreCase = False, o método Test teria pesquisado estritamente a string apple e teria o resultado False, pois apple não está disponível na inputString.