asp.net - Regex to validate email with name.surname@fixed domain -
i wonder if 1 can give me hand on this. need validate email addresses name.surname@domain.com domain.com , dot between name , surname same. use asp validator not know how write regex yet.
<asp:regularexpressionvalidator id="validateemail" runat="server" errormessage="invalid email." controltovalidate="txtemail" validationexpression="???????????" />
^[a-za-z0-9_]+\.[a-za-z0-9_]+@domain.tld$
allow characters a-z, a-z, 0-9 , underscore in first , last names , require domain in end. first , last names have have @ least 1 character.
you can change character set depending on requirements , not sure if need ^ or $ in there, if validation expression automatically assumes whole string.
Comments
Post a Comment