Class StringPatternMatches


  • public class StringPatternMatches
    extends Object
    Iterates through multiple regular expression matches within a character sequence.
    • Constructor Detail

      • StringPatternMatches

        public StringPatternMatches​(CharSequence input,
                                    Collection<Pattern> patterns,
                                    boolean discard)
        Constructs a new string pattern match iterator. If discard is true, then a pattern is discarded after it is first matched.
        Parameters:
        input - the character sequence to match regular expression patterns against.
        patterns - a collection of regular expression patterns to match.
        discard - indicates patterns be discarded after they yield a match.
    • Method Detail

      • next

        public Matcher next()
        Returns the next match from the character sequence. Matches are returned in the order they are encountered in the character sequence, then by the order they are expressed in the supplied patterns collection.
        Returns:
        the next Matcher from the character sequence.
        Throws:
        NoSuchElementException - if the reader has no more matches.
      • hasNext

        public boolean hasNext()
        Returns true if the character sequence has more matches.
        Returns:
        true if the character sequence has more matches.