AmazonScrape.Parser.GetMultipleRegExMatches C# (CSharp) 메소드

GetMultipleRegExMatches() 개인적인 정적인 메소드

Attempts to match the supplied pattern to the input string. Obtains multiple matches and returns a list of string matches if successful and an empty list of strings if no matches found.
private static GetMultipleRegExMatches ( string inputString, string regExPattern ) : List
inputString string String to search
regExPattern string RegEx pattern to search for
리턴 List
        private static List<string> GetMultipleRegExMatches(
            string inputString,
            string regExPattern)
        {
            string msg;
            List<string> results = new List<string>();
            try
            {
                MatchCollection matches = Regex.Matches(inputString,
                    regExPattern,
                    RegexOptions.Singleline);
                if (matches.Count == 0) return results;

                IEnumerator e = matches.GetEnumerator();
                while (e.MoveNext())
                {
                    results.Add(((Match)e.Current).Value);
                }
            }
            catch (ArgumentException ex)
            {
                msg = regExPattern;
                Debug.WriteLine(ex.InnerException +
                    " argument exception for pattern " + msg);
            }
            catch (RegexMatchTimeoutException ex)
            {
                msg = regExPattern;
                Debug.WriteLine(ex.InnerException +
                    " timeout exception for pattern " + msg);
            }
            return results;
        }