regex class : Match(string) method
Description
Gets a first substring in the argument which matches with the regular expression.
Syntax
regexInstance.Match(string source)
Arguments
| Class | Name | Description |
| string | source | A string which is searched. |
Return value
| Class | Description |
| string | A first substring which matches with the regular expression. |
Sample code
| 1: | regex pattern = new regex("(a+)"); |
| 2: | string firstMatch = pattern.Match("aaabbbaaccc"); // "aaa". |
Notes
It's a wrapper of the System.Text.RegularExpressions.Regex.Match(String) method.
If no match is found, return value is empty string.


