RegexOptions Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides enumerated values to use to set regular expression options.
This enumeration supports a bitwise combination of its member values.
public enum class RegexOptions
[System.Flags]
public enum RegexOptions
[<System.Flags>]
type RegexOptions =
Public Enum RegexOptions
- Inheritance
- Attributes
Fields
| Name | Value | Description |
|---|---|---|
| None | 0 | Specifies that no options are set. For more information about the default behavior of the regular expression engine, see the "Default Options" section in the Regular Expression Options article. |
| IgnoreCase | 1 | Specifies case-insensitive matching. For more information, see the "Case-Insensitive Matching" section in the Regular Expression Options article. |
| Multiline | 2 | Multiline mode. Changes the meaning of |
| ExplicitCapture | 4 | Specifies that the only valid captures are explicitly named or numbered groups of the form
|
| Compiled | 8 | Specifies that the regular expression is compiled to MSIL code, instead of being interpreted. Compiled regular expressions maximize run-time performance at the expense of initialization time. For more information, see the "Compiled Regular Expressions" section in the Regular Expression Options article. |
| Singleline | 16 | Specifies single-line mode. Changes the meaning of the dot ( |
| IgnorePatternWhitespace | 32 | Eliminates unescaped white space from the pattern and enables comments marked with |
| RightToLeft | 64 | Specifies that the search will be from right to left instead of from left to right. For more information, see the "Right-to-Left Mode" section in the Regular Expression Options article. |
| ECMAScript | 256 | Enables ECMAScript-compliant behavior for the expression. This value can be used only in conjunction with the IgnoreCase, Multiline, and Compiled values. The use of this value with any other values results in an exception. |
| CultureInvariant | 512 | Specifies that cultural differences in language are ignored. For more information, see the "Comparison Using the Invariant Culture" section in the Regular Expression Options article. |
| NonBacktracking | 1024 | Enable matching using an approach that avoids backtracking and guarantees linear-time processing in the length of the input. For more information, see the Regular Expression Options article. |
| AnyNewLine | 2048 | Make |
Remarks
Several options provided by members of the RegexOptions enumeration (in particular, ExplicitCapture, IgnoreCase, Multiline, and Singleline) can instead be provided by using an inline option character in the regular expression pattern. For details, see Regular Expression Options.