The matches () method of the RegEx class can locate the matching item in the input string based on the given regular expression, and return the matching item as a single matching item. Each matching item is of the match type. The matches () method of the RegEx class has the following four overload methods. (1) RegEx. matches (string input); (2) RegEx. matches (string input, int startat); (3) RegEx. matches (string input, string pattern); (4) RegEx. matches (string input, string pattern, regexoptions options ). The input parameter specifies the input string, the pattern parameter specifies the regular expression, the startat parameter specifies the character location to start searching, and the options parameter specifies the matching option. The following code finds the matching item of the regular expression "/d +" in the string "0123456789abcd321bfr987. The regexmatches () method uses the matches () Static Method of the RegEx class. The matches () method creates a RegEx instance RegEx and uses the matches () instance method of the instance. /// <Summary> /// match the given expression /// </Summary> /// <returns> </returns> private string [] regexmatches () {string input = "0123456789abcd321bfr987"; string pattern = @ "/d +"; matchcollection matches = RegEx. matches (input, pattern); If (matches = NULL) return NULL; string [] result = new string [matches. count]; for (INT I = 0; I <result. length; I ++) {result [I] = matches [I]. value;} return result;} // <summary> // match the given expression // // </Summary> // <returns> </returns> private string [] matches () {string input = "0123456789abcd321bfr987"; string pattern = @ "/d + "; regEx = new RegEx (pattern); matchcollection matches = RegEx. matches (input); If (matches = NULL) return NULL; string [] result = new string [matches. count]; for (INT I = 0; I <result. length; I ++) {result [I] = matches [I]. value;} return result;} the following code is found in the string "abcdabcdedfgedfgwyz ". Find the matching item of the regular expression "[A-Z] +. In addition, the regexoptions. ignorecase option is enabled during the search process. The regexmatches () method uses the matches () Static Method of the RegEx class. The matches () method creates a RegEx instance RegEx and uses the matches () instance method of the instance. /// <Summary> /// match the given expression, with options /// </Summary> /// <returns> </returns> private string [] regexmatchesoptions () {string input = "abcdabcdedfgedfgwyz "; string Pattern = @ "[A-Z] +"; matchcollection matches = RegEx. matches (input, pattern, regexoptions. ignorecase); If (matches = NULL) return NULL; string [] result = new string [matches. count]; for (INT I = 0; I <result. length; I ++) {result [I] = matches [I]. value;} return result;} // <summary> // matches the given expression, with options /// </Summary> /// <returns> </returns> private string [] matchesoptions () {string input = "abcdabcdedfgedfgwyz "; string Pattern = @ "[A-Z] +"; RegEx = new RegEx (pattern, regexoptions. ignorecase); matchcollection matches = RegEx. matches (input); If (matches = NULL) return NULL; string [] result = new string [matches. count]; for (INT I = 0; I <result. length; I ++) {result [I] = matches [I]. value;} return result ;}