public Optional<HString> matchFirst(HString text) {
      TokenMatcher matcher = new TokenMatcher(nfa, text);
      if (matcher.find()) {
         return Optional.of(matcher.group());
      }
      return Optional.empty();
   }
public Optional < HString > matchFirst ( HString text ) { TokenMatcher matcher = new TokenMatcher ( nfa , text ) ; if ( matcher . find ( ) ) { return Optional . of ( matcher . group ( ) ) ; } return Optional . empty ( ) ; }
Match first optional.

@param text the text
@return the optional