I know I can write one myself, but I was hoping I can just reuse an existing one.
Ant-style globs are pretty much the same as normal file globs with the addition that '**' matches subdirectories.
FWIW, my implementation is:
public class AntGlobConverter {
public static String convert(String globExpression) {
StringBuilder result = new StringBuilder();
for (int i = 0; i != globExpression.length(); ++i) {
final char c = globExpression.charAt(i);
if (c == '?') {
result.append('.');
} else if (c == '*') {
if (i + 1 != globExpression.length() && globExpression.charAt(i + 1) == '*') {
result.append(".*");
++i;
} else {
result.append("[^/]*");
}
} else {
result.append(c);
}
}
return result.toString();
}
}