NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Regex Constructor (String, String)

Creates and compiles a regular expression object for the specified regular expression with options that modify the pattern.

[Visual Basic]
Overloads Public Sub New( _
   ByVal pattern As String, _
   ByVal options As String _
)
[C#]
public Regex(
   string pattern,
   string options
);
[C++]
public: Regex(
   String* pattern,
   String* options
);
[JScript]
public function Regex(
   pattern : String,
   options : String
);

Parameters

pattern
The regular expression pattern that defines the search.
options
A string of single-character options that modify the regular expression matching behavior.

Exceptions

Exception Type Condition
MakeException Regular expression parsing error.

Remarks

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.

See Also

Regex Class | Regex Members | System.Text.RegularExpressions Namespace | Regex Constructor Overload List