by Pieter Brinkman
14. January 2009 04:55
The following RegularExporessionValidator checks if the text-input is correct format for a user-name.
<asp:RegularExpressionValidator runat="server" ID="userNameRegexVD" ControlToValidate="userNameTxt" ValidationExpression="^([a-zA-Z])[a-zA-Z_-]*[\w_-]*[\S]$|^([a-zA-Z])[0-9_-]*[\S]$|^[a-zA-Z]*[\S]$" ErrorMessage="Invalid username" />