Is there an equivalent of java.util.regex for "glob" type patterns?

Paul Tomblin picture Paul Tomblin · Aug 8, 2009 · Viewed 34.9k times · Source

Is there a standard (preferably Apache Commons or similarly non-viral) library for doing "glob" type matches in Java? When I had to do similar in Perl once, I just changed all the "." to "\.", the "*" to ".*" and the "?" to "." and that sort of thing, but I'm wondering if somebody has done the work for me.

Similar question: Create regex from glob expression

Answer

finnw picture finnw · Aug 10, 2009

Globbing is also planned for implemented in Java 7.

See FileSystem.getPathMatcher(String) and the "Finding Files" tutorial.