i am trying to validate a simple username textbox using RegularExpressionValidator:
TextBox tbUserName = new TextBox();
tbUserName.ID = "tbUserName";
string strPatternUserName = @"\W";
// i've tried using "\\W", "\w", "\\w","@\w", "/\\w", etc...
// but it always prints my error msg UNLESS the textbox is set to "".
// why does this not work?
RegularExpressionValidator rev = new RegularExpressionValidator();
rev.ControlToValidate = "tbUserName";
rev.Text = "Please enter a username";
rev.ValidationExpression = strPatternUserName;
rev.Display = ValidatorDisplay.Static;
rev.EnableClientScript = false;
please help, thank you.