I would like to convert file names that have spaces and characters containing only the characters AZ, az, period, hyphen and underscore. Something like this regular expression: ([az][AZ]-_\.)+
Of course, I could just do it with a regex. But since I already included many projects in my project (Spring, Hibernate, Apache Commons and much more), I was wondering if something like this is already available.
So the line is like this:
This>is some(string,with $invalid*-chars).jpg
Will be converted to this:
This_is_some_string_with__invalid_-chars_.jpg
source share