RegexDialect Class
Identifies a regular-expression dialect understood by RegexSyntaxTree.
public sealed class RegexDialectRemarks
The set of dialects is closed. Use the static properties to obtain an instance.
Properties
| Name | Description |
|---|---|
| Family | The grammar family the dialect belongs to. |
| Features | The optional constructs the dialect supports. |
| JavaScript | The ECMAScript dialect. |
| Name | The canonical lowercase name of the dialect, such as net or pcre. |
| Net | The .NET dialect, as System.Text.RegularExpressions defines it. |
| PcrePerl | The PCRE and Perl dialect. |
| PosixBasic | POSIX basic regular expressions (BRE), in which the delimiters are spelled with a backslash. |
| PosixExtended | POSIX extended regular expressions (ERE). |
Family
RegexDialect.csFeatures
RegexDialect.csThe optional constructs the dialect supports.
public RegexDialectFeatures Features { get; }Property value
JavaScript
RegexDialect.csThe ECMAScript dialect.
public static RegexDialect JavaScript { get; }Property value
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.
Name
RegexDialect.csThe .NET dialect, as System.Text.RegularExpressions defines it.
public static RegexDialect Net { get; }Property value
PcrePerl
RegexDialect.csPosixBasic
RegexDialect.csPOSIX basic regular expressions (BRE), in which the delimiters are spelled with a backslash.
public static RegexDialect PosixBasic { get; }Property value
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.csPOSIX extended regular expressions (ERE).
public static RegexDialect PosixExtended { get; }Property value
Methods
| Name | Description |
|---|---|
| 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.csReturns true when the dialect supports every feature in feature.
public bool HasFeature(RegexDialectFeatures feature)ToString()
RegexDialect.csTryParse(string?, RegexDialect?)
RegexDialect.csResolves a dialect from its name. Recognizes the canonical names and common aliases such as dotnet.
public static bool TryParse(string? name, out RegexDialect? dialect)