The various options that can be applied to a regular expression are listed below along with a brief explanation.
[System.Flags]
public enum RegexOptions
Member Name | Description |
---|
Compiled | Precompiles the regular expression into an assembly. Although this will speed up the execution time, the startup time will be increased. This is very useful for a static regular expression used constantly. |
CultureInvariant | Enables the regular expression to ignore cultural differences in language when matching. |
ECMAScript | Enables EMCAScript compliant behavior for the regular expression. It must be enabled in conjuction with IgnoreCase, Multiline, and Compiled or else it will raise an exception. |
ExplicitCapture | This mode will change the behavior of the regular expression such that only captures which are explicitly named will be remembered. As a result, unnamed groups become noncapturing groups without the use of the (?:) style. |
IgnoreCase | Enables case insensitive matching of the regular expression. |
IgnorePatternWhitespace | Removes any unescaped whitespace in the pattern. It also enables comments which are identified by the '#' character. |
Multiline | Changes the behavior of the metacharacters ^ and $. With this mode ^ matches the beginning of any line, and $ matches the end of any line. The default behavior is to mach the beginning and ending of the entire string. |
None | This specifies that no options are set for the regular expression. |
RightToLeft | Specifies that the regular expression be run right to left rather than left to right. |
Singleline | This changes the behavior of the metacharacter . to mean any character rather than any character other than \n. |
Namespace: System.Text.RegularExpressions
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0