Regex Constructor (String, RegexOptions)
Initializes a new instance of the Regex class for the specified regular expression, with options that modify the pattern.
Assembly: System (in System.dll)
The pattern parameter consists of regular expression language elements that symbolically describe the string to match. For more information about regular expressions, see the .NET Framework Regular Expressions and Regular Expression Language - Quick Reference topics.
A Regex object is immutable, which means that it can be used only for the match parameters you define when you create it. However, it can be used any number of times without being recompiled.Notes to Callers
This constructor creates a Regex object that uses the default time-out value of the application domain in which it is created. If a time-out value has not been defined for the application domain, the Regex object uses the value InfiniteMatchTimeout, which prevents the operation from timing out. The recommended constructor for creating a Regex object is Regex::Regex(String, RegexOptions, TimeSpan), which lets you set the time-out interval.
The following example illustrates how to use this constructor to instantiate a regular expression that matches any word that begins with the letters "a" or "t".
Note that the match collection includes the word "The" that begins the text because the options parameter has defined case-insensitive comparisons.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8