/// <summary> /// This function adds a new entry to the dictionary /// The return value indicates if the add was successful. /// If the add failed the value "LastException" stores the exception which had been occurred. /// </summary> /// <param name="name">Name of the regex expression. This name will be used for creating the result dictionary</param> /// <param name="RegexElement">RegexElement with the regex search string and with the optional regex options</param> /// <returns>Flag if the add was successful </returns> /// true = successfull /// false = failed public bool Add(string name, RegexElement regexElement) { try { _regexList.Add(name, regexElement); return(true); } catch (Exception ex) { _lastException = ex; return(false); } }
/// <summary> /// Constructor for building a RegExList instance /// </summary> /// <param name="name">Name of the regex. This name will be used for creating the result dictionary</param> /// <param name="RegexElement">RegexElement with the regex search string and with the optional regex options</param> public RegExList(string name, RegexElement regexElement) { try { _regexList = new Dictionary <string, RegexElement>(); _regexList.Add(name, regexElement); _lastException = null; } catch (Exception ex) { _regexList = null; _lastException = ex; } }