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

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

Attempts to match the supplied pattern to the input string. Only obtains a single match and returns the matching string if successful and an empty string if not.
private static GetSingleRegExMatch ( string inputString, string regExPattern ) : string
inputString string String to be searched
regExPattern string Pattern to be matched
리턴 string
        private static string GetSingleRegExMatch(string inputString,
            string regExPattern)
        {
            string msg;
            string result = "";
            try
            {
                Match match = Regex.Match(inputString,
                    regExPattern,
                    RegexOptions.Singleline);
                if (match.Success)
                {
                    result = match.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 result;
        }