Verify the control cases and the descriptions of several special symbols in the regular expression!
Source: Internet
Author: User
<% @ Page Language = "VB" ContentType = "text/html" ResponseEncoding = "gb2312" %>
<Head>
<Title> validation Control </title>
</Head>
<Body>
<Form runat = "server">
<P> input name:
<Asp: TextBox ID = "nam" Text = "name" TextMode = "SingleLine" runat = "server"/> <asp: requiredFieldValidator ControlToValidate = "nam" Display = "Dynamic" ErrorMessage = "must enter the name" ID = "rnam" runat = "server"/> </p>
<P> input date:
<Asp: TextBox ID = "dat" Text = "date" TextMode = "SingleLine" runat = "server"/> <asp: compareValidator ControlToValidate = "dat" Display = "Dynamic" ErrorMessage = "the correct format of the date is yyyy-mm-dd" ID = "rdat" Operator = "DataTypeCheck" runat = "server" type = "Date"/> </p>
<P> input value (integer ):
<Asp: TextBox ID = "type" Text = "value" TextMode = "SingleLine" runat = "server"/> <asp: compareValidator ControlToValidate = "type" Display = "Dynamic" ErrorMessage = "you entered not an Integer" ID = "rtype" Operator = "DataTypeCheck" runat = "server" Type = "Integer "/> </p>
<P> input number (1-10 ):
<Asp: TextBox ID = "num" Text = "value" TextMode = "SingleLine" runat = "server"/> <asp: rangeValidator ControlToValidate = "num" Display = "Dynamic" ErrorMessage = "only numbers between 1 and 10" ID = "rnum" Type = "Integer" MaximumValue = "10" MinimumValue = "1 "runat =" server "/> </p>
<P> enter a value smaller than 50:
<Asp: TextBox ID = "num5" Text = "TextMode =" SingleLine "runat =" server "/>
<Asp: compareValidator ControlToValidate = "num5" Display = "Dynamic" ErrorMessage = "you enter no less than 50" ID = "rnum5" Operator = "LessThan" runat = "server" Type =" integer "ValueToCompare =" 50 "/> </p>
<P> enter an email at will:
<Asp: TextBox ID = "eml" Text = "email" TextMode = "SingleLine" runat = "server"/>
<Asp: RegularExpressionValidator ControlToValidate = "eml" Display = "Dynamic" ErrorMessage = "should be 3-6 arbitrary characters @ 2-9 arbitrary characters. 2-3 arbitrary characters "ID =" reml "runat =" server "ValidationExpression = ". {3, 6 }@. {2, 9 }\.. {2, 3} "/>
<Asp: ValidationSummary DisplayMode = "List" HeaderText = "error message set" ID = "tt" runat = "server"/> </p>
<P>
<Asp: Button ID = "But" Text = "Submit" runat = "server"/> </p>
</P>
</Form>
<P> RegularExpressionValidator control expression Description: </p>
<P> <strong> Square brackets "[]" </strong> Use and define acceptable characters. [Abc123] indicates that the control can only accept the six characters a, B, c, 1, 2, and 3. </p>
<P> <strong> the inverse collection symbol "^" </strong> is used to define unacceptable characters. [^ A-h] indicates that the control is acceptable except for 8 characters a to h. </p>
<P> <strong> curly braces "{}" </strong> define the number of characters that must be entered. {6} indicates that only six characters can be entered; {6,} indicates that more than six characters must be entered; {} indicates that 2 to 6 characters must be entered; however, curly braces must be placed behind square brackets. For example, [a-z] {4} indicates that any character between 4 digits a and z must be entered. </P>
<P> <strong> small dot "." </strong> is used to represent any character. For example,. {3, 6} indicates to accept 3 to 6 arbitrary characters. </P>
<P> <strong> vertical line "|" </strong> is a logical symbol used to represent "or. For example, [1-9] {3, 6} | [A-Za-z] {3} indicates that 3 to 6 digits or 3 letters are allowed. (Case sensitivity can be different.) </p>
<P> <strong> parentheses "()" </strong> are used for chunking. They are similar to parentheses in numeric operations. </P>
<P> <strong> slash "\" </strong> if you want acceptable characters to include the preceding special characters. For example, \ ([0-9] {3} \) indicates the phone number in the format of "(xxx. </P>
<P> & nbsp; </p>
</Body>
</Html>
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