Code example for Pattern

Methods: matcher

0
    this.start = new Date(start.getTime());
    this.end = new Date(end.getTime());
  } 
   
  public boolean accept(Path path) {
    Matcher matcher = PATTERN.matcher(path.toString());
    if (matcher.matches()) {
      DateFormat format = new SimpleDateFormat("yyyy/MM/dd");
      try { 
        return inInterval(format.parse(matcher.group(1)));
      } catch (ParseException e) {
        return false; 
      } 
    } 
    return false; 
  } 
 
  private boolean inInterval(Date date) {
    return !date.before(start) && !date.after(end);
  }