Regex.Options 属性


获取传递给 Regex 构造函数的选项。Gets the options that were passed into the Regex constructor.

 property System::Text::RegularExpressions::RegexOptions Options { System::Text::RegularExpressions::RegexOptions get(); };
public System.Text.RegularExpressions.RegexOptions Options { get; }
member this.Options : System.Text.RegularExpressions.RegexOptions
Public ReadOnly Property Options As RegexOptions


RegexOptions 枚举 的一个或多个成员表示传递至 Regex 构造函数的选项。One or more members of the RegexOptions enumeration that represent options that were passed to the Regex constructor


Options 属性的值由 RegexOptions 枚举的一个或多个成员组成。The value of the Options property consists of one or more members of the RegexOptions enumeration. 如果 Regex 类构造函数中未定义任何选项,则会 RegexOptions.None其值。If no options were defined in the Regex class constructor, its value is RegexOptions.None. 正则表达式选项主题中详细讨论了可用选项。The available options are discussed in detail in the Regular Expression Options topic.

请注意,Options 属性不反映正则表达式模式本身中定义的内联选项。Note that the Options property does not reflect inline options defined in the regular expression pattern itself.


RegexCompileToAssembly 方法创建的正则表达式的基类。 Regex is the base class of regular expressions created by the CompileToAssembly method. 这些已编译的正则表达式使用 Options 属性的基类实现。These compiled regular expressions use the base class implementation of the Options property. 如果是从派生类调用的,则 Options 属性返回传递给用于定义正则表达式的 RegexCompilationInfo 类构造函数的 options 参数的选项。If called from a derived class, the Options property returns the options that were passed to the options parameter of the RegexCompilationInfo class constructor that was used to define the regular expression.