Package java.util.regex

Examples of java.util.regex.Matcher.groupCount()


    }

    final Matcher matcher = PATTERN.matcher(input);

    while (matcher.find()) {
      for (int i = 1; i <= matcher.groupCount(); i++) {
        if (matcher.group(i) != null) {
          switch (i) {
            case 1: // literal string
              node_list.add(TextNode.create(matcher.group(i)));
              break;
View Full Code Here


        Matcher m = pattern.matcher(parser.get(range));
        if (!m.matches()) {
            parser.recordError(range, SCHEME_PATTERN_MATCH_FAILED);
            return;
        }
        for (int g = 1; g <= m.groupCount(); g++)
            if (m.start(g) != -1)
                actions[g].check(m, parser, range);

    }
}
View Full Code Here

    private int classify(String string) {
        Matcher m = keyword.matcher(string);
        if (!m.matches())
            return OTHER;
        for (int i = 1; i <= m.groupCount(); i++)
            if (m.start(i) != -1)
                return i;
        throw new IllegalStateException(
                "IRI code internal error: no group matched.");
    }
View Full Code Here

      }
     
      Matcher seen_matcher = DO_PATTERN.matcher(arguments);
     
      if (!seen_matcher.matches() ||
        seen_matcher.groupCount() != 2)
      {
        bot.send(new Privmsg(nick, "Invalid syntax '" + command + " " + arguments + "'"));
        return;
      }
     
View Full Code Here

      }
     
      Matcher seen_matcher = SAY_PATTERN.matcher(arguments);
     
      if (!seen_matcher.matches() ||
        seen_matcher.groupCount() != 2)
      {
        bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'"));
        return;
      }
     
View Full Code Here

        }

        Matcher logsearch_matcher = SEARCH_PATTERN.matcher(arguments);

        if (!logsearch_matcher.matches() ||
          logsearch_matcher.groupCount() != 2)
        {
          bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'"));
          return;
        }
View Full Code Here

      }
     
      Matcher seen_matcher = SEEN_PATTERN.matcher(arguments.toLowerCase());
     
      if (!seen_matcher.matches() ||
        seen_matcher.groupCount() != 2)
      {
        bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'"));
        return;
      }
     
View Full Code Here

      }
     
      Matcher register_matcher = REGISTER_PATTERN.matcher(arguments);
     
      if (!register_matcher.matches() ||
        register_matcher.groupCount() != 2)
      {
        bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'"));
        return;
      }
     
View Full Code Here

      {
        Matcher logsearch_matcher = HELP_PATTERN.matcher(arguments.toLowerCase());
       
        // check if the syntax is correct
        if (!logsearch_matcher.matches() ||
          (logsearch_matcher.groupCount() < 1 &&
           logsearch_matcher.groupCount() > 2))
        {
          bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'."));
          return;
        }
View Full Code Here

        Matcher logsearch_matcher = HELP_PATTERN.matcher(arguments.toLowerCase());
       
        // check if the syntax is correct
        if (!logsearch_matcher.matches() ||
          (logsearch_matcher.groupCount() < 1 &&
           logsearch_matcher.groupCount() > 2))
        {
          bot.send(new Privmsg(nick, "Invalid syntax '"+command+" "+arguments+"'."));
          return;
        }
       
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.