RegexDialect Class

Identifies a regular-expression dialect understood by RegexSyntaxTree.

public sealed class RegexDialect

Remarks

The set of dialects is closed. Use the static properties to obtain an instance.

Properties

NameDescription
FamilyThe grammar family the dialect belongs to.
FeaturesThe optional constructs the dialect supports.
JavaScriptThe ECMAScript dialect.
NameThe canonical lowercase name of the dialect, such as net or pcre.
NetThe .NET dialect, as System.Text.RegularExpressions defines it.
PcrePerlThe PCRE and Perl dialect.
PosixBasicPOSIX basic regular expressions (BRE), in which the delimiters are spelled with a backslash.
PosixExtendedPOSIX extended regular expressions (ERE).

The grammar family the dialect belongs to.

public RegexDialectFamily Family { get; }

Property value

RegexDialectFamily

The optional constructs the dialect supports.

public RegexDialectFeatures Features { get; }

Property value

RegexDialectFeatures

JavaScript

RegexDialect.cs

The ECMAScript dialect.

public static RegexDialect JavaScript { get; }

Property value

RegexDialect

Remarks

Both Unicode flags are honoured. u makes a surrogate pair one atom; v additionally turns on the class set grammar, so a class may nest, be intersected with &&, have another subtracted with --, and contain a \q{…} string disjunction.

The canonical lowercase name of the dialect, such as net or pcre.

public string Name { get; }

Property value

string

The .NET dialect, as System.Text.RegularExpressions defines it.

public static RegexDialect Net { get; }

Property value

RegexDialect

The PCRE and Perl dialect.

public static RegexDialect PcrePerl { get; }

Property value

RegexDialect

PosixBasic

RegexDialect.cs

POSIX basic regular expressions (BRE), in which the delimiters are spelled with a backslash.

public static RegexDialect PosixBasic { get; }

Property value

RegexDialect

Remarks

\(…\) groups, \{n,m\} bounds, and backreferences are all supported. Alternation with \| and the \+ and \? quantifiers are GNU extensions rather than POSIX proper, and are accepted.

PosixExtended

RegexDialect.cs

POSIX extended regular expressions (ERE).

public static RegexDialect PosixExtended { get; }

Property value

RegexDialect

Methods

NameDescription
HasFeature(RegexDialectFeatures)Returns true when the dialect supports every feature in feature.
ToString()
TryParse(string?, RegexDialect?)Resolves a dialect from its name. Recognizes the canonical names and common aliases such as dotnet.

HasFeature(RegexDialectFeatures)

RegexDialect.cs

Returns true when the dialect supports every feature in feature.

public bool HasFeature(RegexDialectFeatures feature)

Parameters

feature RegexDialectFeatures

Returns

bool

ToString()

RegexDialect.cs
public override string ToString()

Returns

string

No documentation is available.

TryParse(string?, RegexDialect?)

RegexDialect.cs

Resolves a dialect from its name. Recognizes the canonical names and common aliases such as dotnet.

public static bool TryParse(string? name, out RegexDialect? dialect)

Parameters

name string?
dialect RegexDialect?

Returns

bool