/// <summary> Searches for the next substring that matches the regular expression. /// After calling this method, the caller would call methods like /// <code>skipped</code>, <code>matched</code>, etc. to query attributes /// of the matched region. /// <p> /// Calling this function again will search for the next match, beginning /// at the character just after where the last match ended. /// /// </summary> /// <returns> <code>true</code> if a match was found, <code>false</code> /// if there are no more matches. /// </returns> public bool nextMatch() { ustart = end; /* * Consume one character if the last match didn't consume any * characters, to avoid an infinite loop. */ int off = ustart; if (off == mstart) { off++; if (off >= str.Length) { return(false); } } m = r.exec(str, 0, off); if (m == null) { return(false); } mstart = m.indices[0]; end = m.indices[1]; return(true); }
/// <summary> /// Searches for the next substring that matches the regular expression. /// After calling this method, the caller would call methods like /// <code>skipped</code>, <code>matched</code>, etc. to query attributes /// of the matched region. /// Calling this function again will search for the next match, beginning /// at the character just after where the last match ended. /// </summary> /// <returns> /// <code>true</code> if a match was found, <code>false</code> /// if there are no more matches. /// </returns> public bool nextMatch() { _ustart = _end; // Consume one character if the last match didn't consume any characters, to avoid an infinite loop. int off = _ustart; if (off == _mstart) { off++; if (off >= _str.Length) { return(false); } } _m = _r.exec(_str, 0, off); if (_m == null) { return(false); } _mstart = _m._indices[0]; _end = _m._indices[1]; return(true); }