In Java, I\'ve a File-Name-String. There I want to replace all illegal Characters with \'_\', but not a-z, 0-9, -,. and <
a-z
0-9
-
.
If you are looking for options on windows platform then you can try below solution to make use of all valid characters other than "\/:*?"<>|" in file name.
fileName = fileName.replaceAll("[\\\\/:*?\"<>|]", "_");