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}
Javascript controls how to enter only numbers and decimal places in the text box
This article describes how to enter only numbers and decimal places in the javascript control text box. The example shows how to use a regular expression in javascript
Regular Expression matching Chinese characters: [\ u4e00-\ u9fa5]
Match double-byte characters (including Chinese characters): [^ \ x00-\ xFF]
Application: Calculate the length of a string (two-byte length Meter 2, ASCII character meter 1)
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
109. Change the status bar self. Status = "";//
110. Change the window size window. resizeTo (200,300 );//
111. Change the mouse style body {cursor: URL ('mouse. Ani '); SCROLLBAR-BASE-COLOR: #506aa8; SCROLLBAR-ARROW-COLOR: # 14213f ;}//
112.
Match double-byte characters (including Chinese characters): [^ \ x00-\ xFF]
Application: Calculate the length of a string (two-byte length Meter 2, ASCII character meter 1)
String. Prototype. Len = function () {return this. Replace ([^ \ x00-\
C # Regular Expression Summary
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 numbers starting with
We all know the usefulness of regular expressions, which are usually accumulated and time-saving.
The following is a regular expression for C # That I have spent a lot of time organizing. A newbie must pay attention to the manual, which can save a
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 numbers starting with zero and non-zero can be
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Keypress event of the text box:Write the following code in the keypress event of the text box (such as txtnum) You want to enter:Private void
Keyword: Regular Expression Pattern Matching Javascript
Abstract: Common regular expressions are collected.
Regular expressions are used for string processing, form verification, and other occasions. They are practical and efficient, but they are
The following describes the verification functions and expressions used to verify the control using regularexpressionvalidator:
Only numbers can be entered: "^ [0-9] * $"Only n digits can be entered: "^ d {n} $" matches n digits "/d {n }".You can
Common Regular Expressions/Corresponding escape characters/syntax
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,
A regular expression is a text mode consisting of common characters (such as characters a to z) and special characters (such as metacharacters. This mode describes one or more strings to be matched when searching the text subject. A regular
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 numbers starting with zero and non-zero can be
For some front-end regular expressions, you can modify them to be php regular expressions.
Match double-byte characters (including Chinese characters): [^ \ x00-\ xff]
Application: calculate the length of a string (two-byte length meter 2, ASCII
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.