RegExMatch
A retained match with captures and positions in the original subject.
Obtain results through RegEx.Search or RegEx.SearchAll. Check for null first, then use GetString() for the whole match or GetString("name") for a group. Group 0 is the complete match; other numbers identify capturing parentheses.
GetStart/GetEnd refer to the original subject in native 32-bit units. After a non-BMP character these differ from C# UTF-16 indices. GetEnd is exclusive. Absent/nonparticipating groups have -1 positions; a participating empty group has equal nonnegative positions.
Strings is string[]; Names maps participating named groups to their numbers. Clearing the original RegEx does not erase an existing result.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
RegExMatchConstructor
public RegExMatch();Creates an empty container with no search result. Normally obtain RegExMatch through Search or SearchAll: construction performs no search.
Properties3
NamesProperty
public Reckfell.Collections.Dictionary Names { get; }Participating named groups and their numbers, as in GetNames. An unmatched optional group is omitted. Key order is not a substitute for capture numbers.
StringsProperty
public string[] Strings { get; }Managed string[] containing the whole match and groups, as in GetStrings. Not Reckfell.Collections.Array. Empty text does not distinguish an empty capture from a nonparticipating group.
SubjectProperty
public string Subject { get; }Entire original search subject, as in GetSubject; group positions refer to it.
Methods7
GetEndint
public int GetEnd(Variant? name = default);Reads the group exclusive end in original Subject. Compute GetEnd - GetStart only after checking start >= 0. Units are native 32-bit units.
| Name | Type | Default |
|---|---|---|
name | Variant? | default |
nameGroup number or string name. Omitted/null selects group 0. Use valid nonnegative group numbers; -1 in a returned position means absent, not an input index.
intPosition, or -1 if the group is absent/nonparticipating. A participating empty group has equal nonnegative start/end positions.
GetGroupCountint
public int GetGroupCount();Returns capture-group count, excluding group 0. Includes groups that did not participate in this match.
intCapture count excluding the whole match; 0 in an empty container.
GetNamesReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary GetNames();Creates a name → group-number dictionary for participating named groups only. Mutating the returned dictionary does not reconfigure the stored result. Duplicate names select the first participating entry.
Reckfell.Collections.DictionaryNew Dictionary mapping String names to integer group numbers.
GetStartint
public int GetStart(Variant? name = default);Reads group start in original Subject. Group 0 is the whole match. Position uses native 32-bit units, not C# UTF-16 indices or visible grapheme counts.
| Name | Type | Default |
|---|---|---|
name | Variant? | default |
nameGroup number or string name. Omitted/null selects group 0. Use valid nonnegative group numbers; -1 in a returned position means absent, not an input index.
intPosition, or -1 if the group is absent/nonparticipating. A participating empty group has equal nonnegative start/end positions.
GetStringstring
public string GetString(Variant? name = default);Returns selected group text using native positions correctly. Prefer it over C# Substring with GetStart/GetEnd unless indices were explicitly converted.
| Name | Type | Default |
|---|---|---|
name | Variant? | default |
nameGroup number or string name. Omitted/null selects group 0. Use valid nonnegative group numbers; -1 in a returned position means absent, not an input index.
stringGroup text or an empty string. Check GetStart to distinguish an empty capture from absence.
GetStringsstring[]
public string[] GetStrings();Returns managed string[]: whole match at index 0, then numbered capture groups. Nonparticipating groups have empty strings.
string[]string[]; an empty container has no elements.
GetSubjectstring
public string GetSubject();Returns the entire original search subject, not only matched text. The result retains it after Clear or recompiling the original RegEx.
stringOriginal string value, not just the matched substring.