public static boolean isValidName(String text)
{
Pattern pattern = Pattern.compile(\"^[^/./\\\\:*?\\\"<>|]+$\");
Matcher matcher = pattern.matcher(text
Here you can find which file names are allowed.
The following characters are not allowed:
(greater than)
* (asterisk)
Integer value zero, sometimes referred to as the ASCII NUL character.