Skip to content

Regex.Match Method

Definition

Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll

Overloads

Method Description
Match(string, string) The first match of a pattern in a text, with no flags.
Match(string, string, RegexFlags) The first match of a pattern in a text.
Match(string) The first match in a text.
Match(string, int) The first match in a text at or after a position (at that position alone with Sticky).

Match(string, string)

Source: Regex.Matching.cs

The first match of a pattern in a text, with no flags.

public static Match Match(string input, string pattern)

Parameters

Name Type Description
input string The text.
pattern string The pattern.

Returns

Match

The match, or Empty.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Match(string, string, RegexFlags)

Source: Regex.Matching.cs

The first match of a pattern in a text.

public static Match Match(string input, string pattern, RegexFlags flags)

Parameters

Name Type Description
input string The text.
pattern string The pattern.
flags RegexFlags The flags.

Returns

Match

The match, or Empty.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Match(string)

Source: Regex.Matching.cs

The first match in a text.

public Match Match(string input)

Parameters

Name Type Description
input string The text.

Returns

Match

The match, or Empty.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Match(string, int)

Source: Regex.Matching.cs

The first match in a text at or after a position (at that position alone with Sticky).

public Match Match(string input, int startAt)

Parameters

Name Type Description
input string The text.
startAt int The position, in UTF-16 code units.

Returns

Match

The match, or Empty.

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