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, "_");
Subscribe to:
Post Comments (Atom)
That's not quite right. There are other limitations. For example, a dot at the end of a filename (no extension) is invalid.
ReplyDelete