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.]
Searches the input string for the first occurrence of the specified regular expression, using the specified matching options.
Namespace: System.Text.RegularExpressions
Assembly: System.Text.RegularExpressions (in System.Text.RegularExpressions.dll)
Syntax
'Declaration
Public Shared Function Match ( _
input As String, _
pattern As String, _
options As RegexOptions _
) As Match
public static Match Match(
string input,
string pattern,
RegexOptions options
)
public:
static Match^ Match(
String^ input,
String^ pattern,
RegexOptions options
)
static member Match :
input:string *
pattern:string *
options:RegexOptions -> Match
public static function Match(
input : String,
pattern : String,
options : RegexOptions
) : Match
Parameters
- input
Type: System. . :: . .String
The string to search for a match.
- pattern
Type: System. . :: . .String
The regular expression pattern to match.
- options
Type: System.Text.RegularExpressions. . :: . .RegexOptions
A bitwise combination of the enumeration values that provide options for matching.
Return Value
Type: System.Text.RegularExpressions. . :: . .Match
An object that contains information about the match.
Remarks
The Match(String, String, RegexOptions) method returns the first substring that matches a regular expression pattern in an input string.
The static Match(String, String, RegexOptions) method is equivalent to constructing a Regex object with the Regex(String, RegexOptions) constructor and calling the instance Match(String) method.
The pattern parameter consists of regular expression language elements that symbolically describe the string to match.
You can determine whether the regular expression pattern has been found in the input string by checking the value of the returned Match object's Success property. If a match is found, the returned Match object's Value property contains the substring from input that matches the regular expression pattern. If no match is found, its value is String..::..Empty.
This method returns the first substring found in input that matches the regular expression pattern. You can retrieve subsequent matches by repeatedly calling the returned Match object's NextMatch method. You can also retrieve all matches in a single method call by calling the Regex..::..Matches(String, String, RegexOptions) method.
The RegexMatchTimeoutException exception is thrown if the execution time of the matching operation exceeds the time-out interval specified for the application ___domain in which the method is called. If no time-out is defined in the application ___domain's properties, or if the time-out value is Regex.InfiniteMatchTimeout, no exception is thrown.
.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.