Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Initializes a new instance of the Regex class for the specified regular expression.
Namespace: System.Text.RegularExpressions
Assembly: System.Text.RegularExpressions (in System.Text.RegularExpressions.dll)
Syntax
'Declaration
Public Sub New ( _
pattern As String _
)
public Regex(
string pattern
)
public:
Regex(
String^ pattern
)
new :
pattern:string -> Regex
public function Regex(
pattern : String
)
Parameters
- pattern
Type: System. . :: . .String
The regular expression pattern to match.
Remarks
The pattern parameter consists of regular expression language elements that symbolically describe the string to match.
Calling the Regex(String) constructor is equivalent to calling the Regex(String, RegexOptions) constructor with a value of None for the options argument.
A Regex object is immutable, which means that it can be used only for the match pattern you define when you create it. However, it can be used any number of times without being recompiled.
This constructor instantiates a regular expression object that attempts a case-sensitive match of any alphabetical characters defined in pattern. For a case-insensitive match, use the Regex..::..Regex(String, RegexOptions) constructor.
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.#ctor(String, RegexOptions, TimeSpan), which lets you set the time-out interval.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.