Class TokenMatcher


  • public class TokenMatcher
    extends Object

    The TokenMatcher class allows for iterating of the matches, extracting the match or named-groups within the match, the starting and ending offset of the match, and conversion into a TokenMatch object which records the current state of the match.

    Author:
    David B. Bracewell
    • Method Detail

      • end

        public int end()
        Returns:
        The index of the end token associated with the match
      • find

        public boolean find()
        Returns:
        True if the pattern finds a next match
      • group

        public HString group()
        Returns:
        the span of text covering the match
      • group

        public List<HString> group​(String groupName)
        Gets the list of HString associated with a named group.
        Parameters:
        groupName - the group name
        Returns:
        the list of matches
      • groupNames

        public Set<String> groupNames()
        Returns:
        the named groups in the expression
      • start

        public int start()
        Returns:
        The index of the start token associated with the match