If the match succeeds then more information can be obtained via the start, end, and group methods.
146147148149150151152153154155156
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(
99100101102103104105106107108109
{ 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);
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()) {
7374757677787980818283
{ last_channels = (HashMap)reference.get(); } Matcher detect_matcher = DETECT.matcher(fullMessage.getTrailing()); if (detect_matcher.matches()) { if (null == last_channels) { return; }
8586878889909192939495
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; }
7778798081828384858687
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; } } }
8182838485868788899091
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; }
112113114115116117118119120121122
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; }
156157158159160161162163164165166
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; }