All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jodd.io.filter.RegExpFileFilter Maven / Gradle / Ivy

Go to download

Jodd Core tools and utilities, including type converters, JDateTime, cache etc.

There is a newer version: 5.3.0
Show newest version
// Copyright (c) 2003-2014, Jodd Team (jodd.org). All Rights Reserved.

package jodd.io.filter;

import java.io.File;
import java.util.regex.Pattern;

/**
 * FileFilter that matches files with use of Regular Expression.
 *
 * Some tips for regular expressions:
 * 
    *
  • .* : matches any number of character
  • *
  • .? : matches zero or one character
  • *
*/ public class RegExpFileFilter extends FileFilterBase { private final Pattern regexpPattern; public RegExpFileFilter(String pattern) { regexpPattern = Pattern.compile(pattern); } @Override public boolean accept(File dir, String name) { return regexpPattern.matcher(name).matches(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy