Matches a regular expression with a string and returns the precise result as a RegexMatch object.
[Visual Basic] Overloads Public Function Match( _ ByVal input As String _ ) As Match [C#] public Match Match( string input ); [C++] public: Match* Match( String* input ); [JScript] public function Match( input : String ) : Match;
A Regular Expression Match object.
Match is supplied in two forms: the caller can optionally specify a starting position (via startpos). If not specified, the default startpos is at the beginning or end of the interval (the beginning if the Regex is left-to-right, and the end if right-to-left).
Note that a match can be restricted so that it does not scan by anchoring the regular expression with a ?\G? (at the left for a left-to-right pattern, or at the right for a right-to-left pattern). This restricts the match so that it must start exactly at startpos.
When a Regex is left-to-right (the default), the match and the scan proceed rightward, starting at the character at startpos. When a Regex is right-to-left (constructed with the ?r? option), the match and scan are in the opposite direction and begin with the character at startpos-1.
The static Match methods return the RegexMatch corresponding to the first match of the specified pattern in the specified string. The methods are equivalent to the like-named instance methods and are provided for convenience.
Regex Class | Regex Members | System.Text.RegularExpressions Namespace | Regex.Match Overload List