RegularExpressionValidator regular expression verification email

Source: Internet
Author: User
Tags valid email address
RegularExpressionValidator has two main attributes for validity verification. ControlToValidate contains a value for verification. Take out the value in the text box. For example, ControlToValidate = "TextBox1" ValidationExpression contains a regular expression for verification.
Well, with the above description, we will give an example to illustrate the regular expression. For example, if we want to verify the email entered by the user, what kind of data is a legal email? I can enter: test @ like this, of course I will also enter: xxx@yyy.com.cn, but such input is illegal: xxx @ com.cn or @ xxx.com.cn, and so on, therefore, a valid email address must meet at least the following conditions:
1. It must contain one and only one symbol "@".
2. The first character cannot be "@" or "."
3. "@." or ". @" cannot appear .@
4. The end cannot be the character "@" or "."
Therefore, based on the above principles and the syntax in the above table, we can easily obtain the required template as follows: "=" ^ w + (-w +) | (. w +) * @ [A-Za-z0-9] + ((. |-) [A-Za-z0-9] + )*. [A-Za-z0-9] + $"
See the content of validata6.aspx:
<! -- Source File: formweb page description validate6.aspx -->
</Head>
<Body>
<Center> <P>
<Form runat = "server">
<Center>
<Title> Regular expression verification </title>
<Table bgcolor = "# eeeeee" cellpadding = 10>
<Tr valign = "top">
<Td colspan = 3>
<Asp: Label ID = "lblOutput" Text = "Enter the email address" Font-Name = "Verdana" Font-Size = "10pt" runat = "server"/>
</Td>
</Tr>
<Tr>
<Td align = right>
<Font face = Verdana size = 2> E-mail: </font>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.