Share via


Regex Constructor (String, RegexOptions)

[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, with options that modify the pattern.

Namespace:  System.Text.RegularExpressions
Assembly:  System.Text.RegularExpressions (in System.Text.RegularExpressions.dll)

Syntax

'Declaration
Public Sub New ( _
    pattern As String, _
    matchFlags As RegexOptions _
)
public Regex(
    string pattern,
    RegexOptions matchFlags
)
public:
Regex(
    String^ pattern, 
    RegexOptions matchFlags
)
new : 
        pattern:string * 
        matchFlags:RegexOptions -> Regex
public function Regex(
    pattern : String, 
    matchFlags : RegexOptions
)

Parameters

Remarks

The pattern parameter consists of regular expression language elements that symbolically describe the string to match.

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.

.NET Framework Security

See Also

Reference

Regex Class

Regex Overload

System.Text.RegularExpressions Namespace