Ejemplo n.º 1
0
 /// <summary>
 /// General purpous HasNext method that returns based on the Patten paramiter
 /// </summary>
 /// <param name="patten"></param>
 /// <returns></returns>
 private bool HasNext(Patten patten)
 {
     if (_current_active_patten.Equals(patten))
     {
         return(_next_match.Success);
     }
     else
     {
         return(new Regex(patten.ToString(),
                          RegexOptions.Compiled | RegexOptions.IgnoreCase).Match(_working_string).Success);
     }
 }
Ejemplo n.º 2
0
        // Constructors

        // Methods

        /// <summary>
        /// This method is used by the constructor in the set up phase and also
        /// when a next call is made for a different patten that the one
        /// currently in use
        /// </summary>
        /// <param name="inputString">
        /// Ether the inital string or a copy of the
        /// working string
        /// </param>
        /// <param name="patten">The desired patten to be used</param>
        protected void SetMatchs(string inputString, Patten patten)
        {
            Regex rx = new Regex(patten.ToString(),
                                 RegexOptions.Compiled | RegexOptions.IgnoreCase);

            _current_match = rx.Match(inputString);

            if (!_current_match.Success)
            {
                throw new NoMatchFoundException();
            }

            _next_match            = _current_match.NextMatch();
            _current_active_patten = patten;
        }