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;
        }