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