# Match class
{: .no_toc }

Holds one match that a **RegExp** found in a string: the matched text, where it starts, how many characters it has, and the text captured by the groups of the pattern.

[**RegExp.Execute**](/tB/Packages/Contributed/tbRegExp/RegExp/Execute.md) creates one **Match** for each match it finds and returns them in a [**MatchCollection**](/tB/Packages/Contributed/tbRegExp/MatchCollection/index.md), in the order found. All four properties are read-only, and the values are set once, when **Execute** creates the **Match**.

```tb check_build check_run
Dim re As New RegExp
re.Pattern = "[a-z]+"

Dim m As Match
Set m = re.Execute("42 apples").Item(0)
Debug.Print m.Value       ' apples
Debug.Print m.FirstIndex  ' 3
Debug.Print m.Length      ' 6
```

## Properties

- [FirstIndex](/tB/Packages/Contributed/tbRegExp/Match/FirstIndex.md) -- returns the zero-based position where the match starts
- [Length](/tB/Packages/Contributed/tbRegExp/Match/Length.md) -- returns the number of characters in the match
- [SubMatches](/tB/Packages/Contributed/tbRegExp/Match/SubMatches.md) -- returns the text captured by the groups of the pattern
- [Value](/tB/Packages/Contributed/tbRegExp/Match/Value.md) -- returns the matched text (default member)

## See Also

- [RegExp](/tB/Packages/Contributed/tbRegExp/RegExp/index.md) class -- searches a string and creates the **Match** objects
- [MatchCollection](/tB/Packages/Contributed/tbRegExp/MatchCollection/index.md) class -- holds the matches that **Execute** finds
- [SubMatches](/tB/Packages/Contributed/tbRegExp/SubMatches/index.md) class -- holds the text captured by the groups of one match
- [tbRegExp package](/tB/Packages/Contributed/tbRegExp/index.md) -- overview
