Regular expression option

xiaoxiao2021-03-06  20

.NET Framework routine reference

Regular expression option

You can use an option that affects the matching behavior to modify the regular expression mode. Regular expression options can be set in one of the following two basic methods: You can specify in the options parameter in the Regex (Pattern, Options) constructor, where Options is a bitxoptions enumeration value, or a combination; Inline (? ΜMNSX-IMNSX :) Group constructor or (? IMNSX-IMNSX) Other constructs set them in regular expression mode.

In the internal selection structure, an option or a set of options (-) in front of the option is used to close these options. For example, inline configuration (? IX-MS) will open the IgnoreCase and IgnorePatternwhitespace options to close the multiline and singleline options. By default, all regular expressions options are turned off.

The following table lists the members of the RegexOptions enumeration, as well as equivalent inner option characters. Note that the option RightToleFT and Compiled are only available for overall expression without allowing inline. (They can only be specified in the Options parameter of the regex constructor.) Option NONE and ECMAScript are not allowed.

Regexoption Member Inner Character Description Nonen / A Specifies no options. IgnoreCasei specifies a matching matching. MultiLinem specifies multi-line mode. Change the meaning of ^ and $ to match the beginning and end of any row, not just match the beginning and end of the entire string. EXPLICITCAPTUREN Specifies the only valid capture group in the form of explicitly naming or numbered (? ...). This allows parenthesis to act as a nonapture group, thereby avoiding clumsy in the grammar caused by (?: ...). Compiledn / a Specify regular expressions will be compiled as an assembly. Generate the regular expression of the Microsoft Intermediate Language (MSIL) code; at the expense of longer startup time, get faster execution speed. SINGLINES Specifies a single line mode. Change the meaning of the character (.) To match it with each character (not all characters other than / n). IgnOREPATTERNWHITESPACEX Specifies annotation from the mode to exclude non-escape blank and enable numeric symbols (#). (For a list of escape blank characters, see Character Erosses.) Please note that blank will never be eliminated from the character class. RightToleFTN / A Specifies that search is performed from right to left instead of left to right. Regular expressions with this option will move to the left side of the starting position instead of the right. (Therefore, the starting position should be specified as the end of the string rather than the beginning.) In order to avoid the possibility of constitutive constant expressions with an infinite loop, this option cannot be specified in the medium. However, (? <) Review the post-seminos provides similar alternatives that can be used as sub-expression. RightToleft only changes the search direction. It does not reverse the searched substrings. Forecasting the first and retrospective issuance of the assertion does not change: predict the first search to the right; after review, send the left search. ECMAScriptn / A Specifies that the expressible ECMAScript has been enabled for expressions. This option can only be used with the IgnoreCase and Multiline flags. Use ECMAScript with any other logo will result in anomalous. CultureInvariantN / A Specifies the regional differences in ignore the language. For more information, see Executing non-district domains in RegularExpressions namespace.

See

Regular expression language elements

转载请注明原文地址:https://www.9cbs.com/read-42771.html

New Post(0)