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 to restrict numbers and decimal places, for more information about how to enter
Some common regular expressions in PHP. read some common regular expressions in PHP and match the regular expressions of Chinese characters: [\ u4e00-\ u9fa5] to match double-byte characters (including Chinese characters ): [^ \ x00-\ xff]
Some common regular expression characters in PHP are converted. Match double byte characters (including Chinese characters): [^ x00-xff] application: calculate the length of a String (a double byte character length meter 2, ASCII character meter 1)
Use regular expressions to restrict text box input in a webpage form:
You can only enter Chinese characters using regular expressions: onkeyup = "value = value. replace (/[^ \ u4e00-\ u9fa5]/g, '')" onbeforepaste = "clipboardData. setdata
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. replace
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
With the development of Internet, web applications are becoming more and more popular in people's lives. some netizens will post some articles that contain some uncivilized words and pictures. Now, the country advocates civilized networks and
Copy codeThe Code is as follows:/// ---------------- Author Teng -------------// Verify whether it is nullFunction check_blank (obj, obj_name ){If (obj. value! = ''){Return true;} Else {Alert (obj_name + "cannot be blank! ");Obj. value = "";Return
Remove unnecessary spaces at the beginning and end of the string. g is the full text search for all matching functionString. prototype. Trim () {returnthis. repl remove unnecessary spaces at the beginning and end of the string.
/G is the full text
This article introduces automatic replacement of jsonkeyupreplace. This article introduces the automatic replacement of js onkeyup replace.
Function checkFloatNum (obj) {// replace all non-numeric values first, except numbers and. obj. value =
Some common java Regular Expressions and java Regular Expressions collected
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 :.
Regular expression for matching Chinese characters: [u4e00-u9fa5] matching double byte characters (including Chinese characters): [^ x00-xff] application: calculate the length of a string (a double byte character length meter 2, 1) String. prototype.
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
You can only enter a number and a decimal point using javascript. In some cases, it is still relatively used. The following is a good example. If you are interested, refer
The Code is as follows:
Function gaga (obj) {// a decimal point and
Regular Expression matching Chinese characters: [u4e00-u9fa5] matching 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.
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-\ xff]/g,
Some front-end regular expressions can be modified to match two-byte characters (including Chinese characters) in php: [^ \ x00-\ xff]
Application: calculate the length of a string (two-byte length meter 2, ASCII character meter 1)
String.
1. var Reg =/^ (\ w | [\ u4e00-\ u9fa5]) * $ /;
If (ARR = username. Match (REG ))
{
Ti = 1;
Return ture;
}
Else
{
Alert ("the user name can only contain English letters, numbers and Chinese characters. \ n check whether there are spaces or
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.