Skip to content
CShift0.32

RegexMatch

Struct · namespace System · Since 0.21

struct RegexMatch

A match of a Regex: where it is, its text and the text of its groups.

Name Description
Index The position of the match in the text (bytes).
Length The length of the match (bytes).
Value The matched text.
Text The text that was searched.
Captures The start and end of every group (-1: it did not take part), group 0 (the whole match) first.
GroupNames The names of the groups ("" for unnamed ones), group 0 first.
int Index

The position of the match in the text (bytes).

int Length

The length of the match (bytes).

string Value

The matched text.

string Text

The text that was searched.

int[] Captures

The start and end of every group (-1: it did not take part), group 0 (the whole match) first.

string[] GroupNames

The names of the groups ("" for unnamed ones), group 0 first.

Name Description
GroupCount The number of groups of the pattern (without group 0, the whole match).
Group The text of group n (0: the whole match).
GroupNumber The number of the group (?<name>...).
GroupMatched Whether group n took part in the match (not: an alternative that was not taken, x? without x).
GroupIndex The position of group n in the text (bytes).
int GroupCount()

The number of groups of the pattern (without group 0, the whole match).

string Group(int n)

The text of group n (0: the whole match).

Returns "" if the group did not take part in the match.

Panics when the pattern has no group n.

string Group(string name)

The text of the group (?<name>...).

Returns "" if the group did not take part in the match.

Panics when the pattern has no group of that name.

int GroupNumber(string name)

The number of the group (?<name>...).

Panics when the pattern has no group of that name.

bool GroupMatched(int n)

Whether group n took part in the match (not: an alternative that was not taken, x? without x).

int GroupIndex(int n)

The position of group n in the text (bytes).

Returns -1 if the group did not take part in the match.