共用方式為


IgnoreCase Property (VBScript)

Sets or returns a Boolean value that indicates if a pattern search is case-sensitive or not.

                      object.IgnoreCase [= True | False ]

Arguments

The object argument is always a RegExp object. The value of the IgnoreCase property is False if the search is case-sensitive, True if it is not. Default is False.

Remarks

The following code illustrates the use of the IgnoreCase prope. (Change the value assigned to IgnoreCase property to see its effect.)

Function RegExpTest(patrn, strng)
    Dim regEx, Match, Matches, s

    ' Create the regular expression.
    Set regEx = New RegExp
    regEx.Pattern = patrn
    regEx.IgnoreCase = True
    regEx.Global = True

    ' Do the search.
    Set Matches = regEx.Execute(strng)

    ' Iterate through the Matches collection.
    s = ""
    For Each Match in Matches
      s = s & "Match found at position "
      s = s & Match.FirstIndex & ". "
      s = s & "Match Value is '"
      s = s & Match.Value & "'."
      s = s & vbCRLF
    Next

    RegExpTest = s
End Function
MsgBox(RegExpTest("is.", "IS1 is2 IS3 is4"))

Requirements

Version 5

Applies To: Regular Expression (RegExp) Object

See Also

Reference

Global Property (VBScript)

Pattern Property

Change History

Date

History

Reason

March 2009

Reformatted code example.

Information enhancement.