I am creating an account creation page using asp.net 2.0/C#.
For the username, I have a textbox for username. I also have a dropdown list next to it that has around 10 different domains.
So the actual e-mail address will be something like:
txtUserName.txt + '@' + lstDomains.SelectedItem.Value
The rules I have to follow are as follows:
· 50 characters max (this includes the '@' symbol and the text from the domain dropdown - the length of the domain will be different)
· No UNICODE
· First char must be a letter (must be in ASCII code range of 97-122, 65-90)
· Period ‘.’ (ASCII 46) allowed except for the first and last characters but cannot have two adjacent periods
· All other chars must be in ASCII code range of 48-57 (numbers), 65-90 (uppercase), 95 (underscore), 97-122 (lowercase)
Can someone please please help me write a regex for a RegularExpressionValidator?
Its its too hard or impossible, please help me with a CustomValidator.
I might end up allocating 10 characters for the domain name and the rest for username if things get too complicated.