Skip to content

Regex.IsMatch Method

Definition

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

Overloads

Method Description
IsMatch(string, string) Whether a pattern matches anywhere in a text, with no flags.
IsMatch(string, string, RegexFlags) Whether a pattern matches anywhere in a text.
IsMatch(string) Whether the pattern matches anywhere in a text (at its start alone with Sticky).
IsMatch(string, int) Whether the pattern matches anywhere in a text from a position (at that position alone with Sticky).
IsMatch(ReadOnlySpan<char>) Whether the pattern matches anywhere in a UTF-16 text.
IsMatch(ReadOnlySpan<char>, int) Whether the pattern matches anywhere in a UTF-16 text from a position.
IsMatch(ReadOnlySpan<byte>) Whether the pattern matches anywhere in a UTF-8 text.
IsMatch(ReadOnlySpan<byte>, int) Whether the pattern matches anywhere in a UTF-8 text from a position.

IsMatch(string, string)

Source: Regex.cs

Whether a pattern matches anywhere in a text, with no flags.

public static bool IsMatch(string input, string pattern)

Parameters

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

Returns

bool

true when it does.

Applies To

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

IsMatch(string, string, RegexFlags)

Source: Regex.cs

Whether a pattern matches anywhere in a text.

public static bool IsMatch(string input, string pattern, RegexFlags flags)

Parameters

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

Returns

bool

true when it does.

Applies To

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

IsMatch(string)

Source: Regex.cs

Whether the pattern matches anywhere in a text (at its start alone with Sticky).

public bool IsMatch(string input)

Parameters

Name Type Description
input string The text.

Returns

bool

true when it does.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

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

IsMatch(string, int)

Source: Regex.cs

Whether the pattern matches anywhere in a text from a position (at that position alone with Sticky).

public bool IsMatch(string input, int startAt)

Parameters

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

Returns

bool

true when it does.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

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

IsMatch(ReadOnlySpan<char>)

Source: Regex.cs

Whether the pattern matches anywhere in a UTF-16 text.

public bool IsMatch(ReadOnlySpan<char> input)

Parameters

Name Type Description
input ReadOnlySpan<char> The text.

Returns

bool

true when it does.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

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

IsMatch(ReadOnlySpan<char>, int)

Source: Regex.cs

Whether the pattern matches anywhere in a UTF-16 text from a position.

public bool IsMatch(ReadOnlySpan<char> input, int startAt)

Parameters

Name Type Description
input ReadOnlySpan<char> The text.
startAt int The position, in UTF-16 code units.

Returns

bool

true when it does.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

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

IsMatch(ReadOnlySpan<byte>)

Source: Regex.cs

Whether the pattern matches anywhere in a UTF-8 text.

public bool IsMatch(ReadOnlySpan<byte> utf8)

Parameters

Name Type Description
utf8 ReadOnlySpan<byte> The text. Bytes that are not UTF-8 are read as U+FFFD one at a time.

Returns

bool

true when it does.

Exceptions

Exception Description
RegexMatchTimeoutException The match reached its limit.

Applies To

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

IsMatch(ReadOnlySpan<byte>, int)

Source: Regex.cs

Whether the pattern matches anywhere in a UTF-8 text from a position.

public bool IsMatch(ReadOnlySpan<byte> utf8, int startAt)

Parameters

Name Type Description
utf8 ReadOnlySpan<byte> The text. Bytes that are not UTF-8 are read as U+FFFD one at a time.
startAt int The position, in bytes, at the start of a character.

Returns

bool

true when it does.

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