What is a good regular expression that can validate a text string to make sure it is a valid Windows filename? (AKA not have \\/:*?\"<>| characters).
\\/:*?\"<>|
Path.GetInvalidFileNameChars - Is not a good way. Try this:
if(@"C:\A.txt".IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1) { MessageBox.Show("The filename is invalid"); return; }