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
There’s nothing built-in, but it’s pretty simple to convert something glob-like to a regex:
this works for me, but I’m not sure if it covers the glob “standard”, if there is one 🙂
Update by Paul Tomblin: I found a perl program that does glob conversion, and adapting it to Java I end up with:
I’m editing into this answer rather than making my own because this answer put me on the right track.