Hi all,
Regex is the kind of simple thing that can drive someone crazy. I have to allow in a textbox only numbers, upercases, lowercases, dashes, underscores and dots.
My code is
Regex textValidator = new Regex("[^A-Za-z0-9_]+&");
If (textValidator.IsMatch(mytextbox.Text))
labelError.Text = "only digits, letters and underscores are allowed";
So for simplicity I don't care for dots and dashes now.
When I test my code, all characters are allowed. If I deny my condition, no character is allowed....
I tested numerous variations from forums, none works.
Regards,
Alex
Go to the complete details ...