Package java.util.regex

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


        return result;
    }

    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(
View Full Code Here


        {
            try
            {
                Pattern pattern = Pattern.compile(req.regexp());
                Matcher matcher = pattern.matcher(stringField);
                if (!matcher.matches())
                    errors.rejectValue(field.getName(), errorCodes[1], req.regexp());
            }
            catch (Exception ex)
            {
                if (log.isDebugEnabled()) log.debug("Error validating " + field, ex);
View Full Code Here

    public static boolean matchPattern(String fileName, String regex) {
        if (regex == null) return true;
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(fileName);
        return m.matches();
    }

    public static long getFileOrDirectorySize(File tbrDir) {
        long size = 0;
        if (!tbrDir.isDirectory()) {
View Full Code Here

    {
      last_channels = (HashMap)reference.get();
    }

    Matcher detect_matcher = DETECT.matcher(fullMessage.getTrailing());
    if (detect_matcher.matches())
    {
      if (null == last_channels)
      {
        return;
      }
View Full Code Here

        return;
      }
     
      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

        {
            try
            {
                Pattern pattern = Pattern.compile(req.regexp());
                Matcher matcher = pattern.matcher(stringField);
                if (!matcher.matches())
                    errors.rejectValue(field.getName(), errorCodes[1], req.regexp());
            }
            catch (Exception ex)
            {
                if (log.isDebugEnabled()) log.debug("Error validating " + field, ex);
View Full Code Here

    String output = null;
    if(input != null) {
      for(int i = 0 ; i < fieldRemappings.length ; i++) {
        if(fieldRemappings[i].getMatch() != null && fieldRemappings[i].getReplacement() != null) {
          Matcher matcher = fieldRemappings[i].getMatch().matcher(input);
          if(matcher.matches()) {
            output = matcher.replaceAll(fieldRemappings[i].getReplacement());
            i = fieldRemappings.length;
          }
        }
      }
View Full Code Here

        return;
      }
     
      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

          return;
        }

        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

        return;
      }
     
      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

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.