An object that contains information about the match.
The Regex.Match(string, string) method returns the first substring that matches a regular expression pattern in an input string. For information about the language elements used to build a regular expression pattern, see Regular Expression Language - Quick Reference.
The static Regex.Match(string, string) method is equivalent to constructing a System.Text.RegularExpressions.Regex object with the specified regular expression pattern and calling the instance Regex.Match(string) method. In this case, the regular expression engine caches the regular expression pattern.
The pattern parameter consists of regular expression language elements that symbolically describe the string to match. For more information about regular expressions, see .NET Framework Regular Expressions and Regular Expression Language Elements.
You can determine whether the regular expression pattern has been found in the input string by checking the value of the returned System.Text.RegularExpressions.Match object's Group.Success property. If a match is found, the returned System.Text.RegularExpressions.Match object's Capture.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 in input that matches the regular expression pattern. You can retrieve subsequent matches by repeatedly calling the returned System.Text.RegularExpressions.Match object's Match.NextMatch method. You can also retrieve all matches in a single method call by calling the Regex.Matches(string, string) method.
The System.Text.RegularExpressions.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.