Skip to content

Regex.IsValidPattern Method

Definition

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

Overloads

Method Description
IsValidPattern(ReadOnlySpan<char>, RegexFlags) Whether a pattern is valid in the grammar of ECMA-262 for the flags, decided with nothing allocated. It asks the grammar only: unlike...
IsValidPattern(ReadOnlySpan<char>, RegexFlags, RegexEdition, RegexUnicodeVersion) Whether a pattern is valid in the grammar of ECMA-262 for the flags, of an edition and under a version of Unicode, decided with nothing allocated (see...
IsValidPattern(ReadOnlySpan<byte>, RegexFlags) Whether a UTF-8 pattern is valid in the grammar of ECMA-262 for the flags, decided with nothing allocated and with no transcoding (see...
IsValidPattern(ReadOnlySpan<byte>, RegexFlags, RegexEdition, RegexUnicodeVersion) Whether a UTF-8 pattern is valid in the grammar of ECMA-262 for the flags, of an edition and under a version of Unicode, decided with nothing allocated and with no transcoding. Bytes that are not U...

IsValidPattern(ReadOnlySpan<char>, RegexFlags)

Source: Regex.cs

Whether a pattern is valid in the grammar of ECMA-262 for the flags, decided with nothing allocated. It asks the grammar only: unlike IsValid, which compiles the pattern, it does not apply this engine's limits of size, so a pattern too large to compile is valid here.

public static bool IsValidPattern(ReadOnlySpan<char> pattern, RegexFlags flags)

Parameters

Name Type Description
pattern ReadOnlySpan<char> The pattern, as UTF-16.
flags RegexFlags The flags: Unicode or UnicodeSets choose the grammar, and the others do not change it.

Returns

bool

true when it is; false too when the flags are not valid together.

Applies To

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

IsValidPattern(ReadOnlySpan<char>, RegexFlags, RegexEdition, RegexUnicodeVersion)

Source: Regex.cs

Whether a pattern is valid in the grammar of ECMA-262 for the flags, of an edition and under a version of Unicode, decided with nothing allocated (see IsValidPattern).

public static bool IsValidPattern(ReadOnlySpan<char> pattern, RegexFlags flags, RegexEdition edition, RegexUnicodeVersion unicodeVersion)

Parameters

Name Type Description
pattern ReadOnlySpan<char> The pattern, as UTF-16.
flags RegexFlags The flags.
edition RegexEdition The edition of ECMA-262 whose grammar the pattern is read with.
unicodeVersion RegexUnicodeVersion The version of Unicode whose character database the pattern is read with.

Returns

bool

true when it is; false too when the flags, the edition or the version are not valid together.

Applies To

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

IsValidPattern(ReadOnlySpan<byte>, RegexFlags)

Source: Regex.cs

Whether a UTF-8 pattern is valid in the grammar of ECMA-262 for the flags, decided with nothing allocated and with no transcoding (see IsValidPattern). Bytes that are not UTF-8 are not a pattern.

public static bool IsValidPattern(ReadOnlySpan<byte> utf8Pattern, RegexFlags flags)

Parameters

Name Type Description
utf8Pattern ReadOnlySpan<byte> The pattern, as UTF-8.
flags RegexFlags The flags.

Returns

bool

true when it is.

Applies To

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

IsValidPattern(ReadOnlySpan<byte>, RegexFlags, RegexEdition, RegexUnicodeVersion)

Source: Regex.cs

Whether a UTF-8 pattern is valid in the grammar of ECMA-262 for the flags, of an edition and under a version of Unicode, decided with nothing allocated and with no transcoding. Bytes that are not UTF-8 are not a pattern.

public static bool IsValidPattern(ReadOnlySpan<byte> utf8Pattern, RegexFlags flags, RegexEdition edition, RegexUnicodeVersion unicodeVersion)

Parameters

Name Type Description
utf8Pattern ReadOnlySpan<byte> The pattern, as UTF-8.
flags RegexFlags The flags.
edition RegexEdition The edition of ECMA-262 whose grammar the pattern is read with.
unicodeVersion RegexUnicodeVersion The version of Unicode whose character database the pattern is read with.

Returns

bool

true when it is.

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