Last week I had some time trying to figure out the way I have to find a regular expression for matching invalid windows file name with an underscore charaacter. You may find it helpful at some times.
//to match valid Windows XP file names. Such a file name consists
//of any sequence of characters other than
// / \ : * ? " < > |
String regexp = "[/\\:*?\"<>|]";
return fileName.replaceAll(regexp, "_");