PathMather.matches(Path) don't agree with Pattern.matches(String,CharSequence) for some of predefined character classes. Please see the following test:
-----------------------------------------------------------------------
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Paths;
public class miniTest {
public static void main(String[] args) {
FileSystem fs = FileSystems.getDefault();
System.out.println(fs.getPathMatcher("regex:foo\\d+").matches(Paths.get("foo012")));
System.out.println(fs.getPathMatcher("regex:fo\\so").matches(Paths.get("fo o")));
System.out.println(fs.getPathMatcher("regex:\\w+").matches(Paths.get("foo")));
}
}
-----------------------------------------------------------------------
It's output is
-----------------------------------------------------------------------
false
false
false
-----------------------------------------------------------------------
while all the results of the corresponding Pattern.matches(String, CharSequence) are true
|