Returns the number of matches found after setting the Pattern or Text properties.
Syntax
val& = [form!]VSFlexString.MatchCount
Remarks
Looking for a pattern in a string may result in several matches. The MatchCount value is normally used as an upper bound in loops that enumerate the matches. Information about each specific match can be retrieved using the MatchString, MatchStart, and MatchLength properties.
For example:
fs.Text = "The quick brown fox jumped over the lazy dog."
fs.Pattern = "[qbf][a-z]*"
Debug.Print "Matches found: "; fs.MatchCount
For i = 0 To fs.MatchCount - 1
Debug.Print " "; fs.MatchString(i)
Next
This code produces the following output:
Matches found: 3
quick
brown
fox
Data Type
Long