Length

Returns the number of characters in the match.

Syntax: object.Length

object
required An object expression that evaluates to a Match.

Returns a Long. The property is read-only.

Remarks

The value is the length of the matched text that Value returns. Together with FirstIndex it gives the range of the source string that the match covers.

Example

Dim re As New RegExp
re.Pattern = "b+"

Dim m As Match
Set m = re.Execute("aabbbc").Item(0)
Debug.Print m.Length      ' 3
Debug.Print Len(m.Value)  ' 3

See Also

  • FirstIndex property – the position where the match starts
  • Value property – the matched text
  • Match class – overview