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
-
.
Keep it simple.
myString = myString.replaceAll("[^a-zA-Z0-9.-]", "_");
http://ideone.com/TINsr4