1. Verification Number:Only one number can be entered
Expression ^ \ D $The description matches a number.Matching example 0, 1, 2, 3Example of Mismatch
2. Only n numbers can be enteredExpression ^ \ D {n} $ for example ^ \ D {8} $The description
// Various dimensionsVisible area width of the webpage: Document. Body. clientwidth;Visible area height: Document. Body. clientheight;Visible area height of the webpage: Document. Body. offsetweight (including the width of the edge)Visible area
Integer or decimal point: ^ [0-9] + \. {} [0-9] {} $Only numbers are allowed: "^ [0-9] * $ ".Only n digits can be entered: "^ \ d {n} $ ".You can only enter at least n digits: "^ \ d {n,} $ ".Only m ~ can be input ~ N-digit :. "^ \ D {m, n} $"Only
Two usage methods:
1. Add the regular expression verification control regularexpression_r_rvalidator to the text input box. This method is applicable to webform.In the validationexpression_r_r option, enter the verification rule.In the
C # Regular Expression Summary
Address: http://www.cnblogs.com/maxianghui/archive/2006/05...
Really good. Thanks to this friend.
Only numbers are allowed: "^ [0-9] * $ ".You can only enter n digits: "^" d {n} $ ".You can only enter at least N
Integer or decimal point: ^ [0-9] + \. {} [0-9] {} $Only numbers are allowed: "^ [0-9] * $ ".Only n digits can be entered: "^ \ D {n} $ ".You can only enter at least N digits: "^ \ D {n,} $ ".Only M ~ can be input ~ N-digit :. "^ \ D {m, n} $"Only
Collect common regular expressions.
Regular expressions are used for string processing, form verification, and other occasions. They are practical and efficient, but they are always not sure when used, so they often need to be checked online. I
1: Get the server-side control
Document. getelementbyid (" ");
2: use regular expressions to restrict text box input in a webpage form:
1>. use regular expressions to restrict Chinese characters only: onkeyup ="Value = value. Replace (/[^ \ u4e00-\
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Doctype HTML public "-// W3C // dtd html 4.0 transitional // en"
>
Html
>
Head
>
Title
>
New Document
Title
TestedMatching double-byte characters (including Chinese characters): [^ \ x00-\ xFF] is very useful and recommended
2 recommended web http://mscenter.edu.cn/blog/yongsheng/archive/2004/11/19/308.html
This guy has a lot of regular expressions.
// Various dimensions
S + = "\ r \ n visible area width of the webpage:" + document. Body. clientwidth;
S + = "\ r \ n visible area of the webpage:" + document. Body. clientheight;
S + = "\ r \ n visible area of the webpage Height:" + document. Body.
1. Only numbers can be entered in the text box above.Code(Decimal point cannot be entered ):
2. Only numbers can be entered and decimal points can be entered. (Note Chinese characters. There is a difference between using the input method and
Regular Expression used for regular expression table expression set matching Chinese characters: [/u4e00-/u9fa5]
Match double-byte characters (including Chinese characters): [^/x00-/xFF]
Application: Calculate the length of a string (two-byte
Regular expressions are used for string processing, form verification, and other occasions. They are practical and efficient, but they are always not sure when used, so they often need to be checked online. I will add some frequently-used
Copy codeThe Code is as follows: // ---------------- Author Teng -------------
// Verify whether it is null
Function check_blank (obj, obj_name ){
If (obj. value! = ''){
Return true;
} Else {
Alert (obj_name + "cannot be blank! ");
Obj. value =
Now, let's get down to the truth. I found a lot of ways to restrict text boxes on the Internet, so I had to practice it on my own and practice it. That's right.
Copy codeThe Code is as follows: function chkPrice (obj ){
Obj. value = obj. value.
/*
Determines whether the specified content is null. If it is null, a warning box is displayed.
*/
Function isEmpty (theValue, strMsg ){
If (theValue = ""){
Alert (strMsg + "cannot be blank! ");
Return true;
}
Return false;
}
/*
Chinese judgment
Only numbers are allowed: "^ [0-9] * $ ".
You can only enter n digits: "^" d {n} $ ".
You can only enter at least n digits: "^" d {n,} $ ".
Only m ~ can be input ~ N-digit :. "^" D {m, n} $"
Only numbers starting with zero and non-zero can be
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