I already gone through some question in StackOverflow regarding this but nothing helped much in my case.
I want to restrict the user to provide a filename that shoul
This is a minor change to Engineers answer.
string regex = @"^[\w\- ]+[\w\-. ]*$"
This will block ".txt" which isn't valid.
".txt"
Trouble is, it does block "..txt" which is valid
"..txt"