Creates and compiles a regular expression object for the specified regular expression.
[Visual Basic] Overloads Public Sub New( _ ByVal pattern As String _ ) [C#] public Regex( string pattern ); [C++] public: Regex( String* pattern ); [JScript] public function Regex( pattern : String );
Exception Type | Condition |
---|---|
MakeException | Regular expression parsing error |
The single-argument constructor creates and compiles a Regex object for the specified regular expression. The two-argument constructor takes a second string argument that contains option characters which modify the matching pattern.
A Regex object is immutable, it can be used only for the match parameters defined when it is instantiated. It can be used any number of times without being recompiled, however.
Regex Class | Regex Members | System.Text.RegularExpressions Namespace | Regex Constructor Overload List