Regex.TryMatch Method
Definition
Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll
Overloads
| Method | Description |
|---|---|
| TryMatch(ReadOnlySpan<char>, int, Span<ValueCapture>, ValueMatch) | Finds the first match in a UTF-16 text at or after a position and reports what each group captured, allocating nothing. |
| TryMatch(ReadOnlySpan<byte>, int, Span<ValueCapture>, ValueMatch) | Finds the first match in a UTF-8 text at or after a position and reports what each group captured, allocating nothing. |
TryMatch(ReadOnlySpan<char>, int, Span<ValueCapture>, ValueMatch)
Source: Regex.Matching.cs
Finds the first match in a UTF-16 text at or after a position and reports what each group captured, allocating nothing.
public bool TryMatch(ReadOnlySpan<char> input, int startAt, Span<ValueCapture> captures, out ValueMatch match)
Parameters
| Name | Type | Description |
|---|---|---|
input |
ReadOnlySpan<char> |
The text. |
startAt |
int |
The position, in UTF-16 code units. |
captures |
Span<ValueCapture> |
Receives the match as element 0 and each group in order; its length must be at least GroupCount + 1. |
match |
ValueMatch |
The match. |
Returns
true when there is a match.
Exceptions
| Exception | Description |
|---|---|
RegexMatchTimeoutException |
The match reached its limit. |
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
TryMatch(ReadOnlySpan<byte>, int, Span<ValueCapture>, ValueMatch)
Source: Regex.Matching.cs
Finds the first match in a UTF-8 text at or after a position and reports what each group captured, allocating nothing.
public bool TryMatch(ReadOnlySpan<byte> utf8, int startAt, Span<ValueCapture> captures, out ValueMatch match)
Parameters
| Name | Type | Description |
|---|---|---|
utf8 |
ReadOnlySpan<byte> |
The text. |
startAt |
int |
The position, in bytes, at the start of a character. |
captures |
Span<ValueCapture> |
Receives the match as element 0 and each group in order; its length must be at least GroupCount + 1. |
match |
ValueMatch |
The match. |
Returns
true when there is a match.
Exceptions
| Exception | Description |
|---|---|
RegexMatchTimeoutException |
The match reached its limit. |
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests.
Open an issue