JS regular expression

Time:2021-4-29

JS code

function SubmitCk() {
var reg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[ a-zA-Z0-9][email protected]([a-zA-Z0-9]+[_|\_|\.]?)*[ a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
if (! Reg. Test ($(“# txtemail”). Val()) {
alert (“please input correct email address”)
return false
}
}

Regular expression set for verifying numbers  
Verification number: ^ [0-9]*$  
Verify n-digit numbers: ^ {D {n}$  
Verify at least n digits: ^ – D {n,}$  
Verify the number of M-N bits: ^ – D {m, n}$  
Verify zero and non-zero numbers: ^ (0 | [1-9] [0-9] *)$  
Verify the positive real number with two decimal places: ^ [0-9] + (. [0-9] {2})$  
Verify the positive real number with 1-3 decimal places: ^ [0-9] + (. [0-9] {1,3})$  
Verify non-zero positive integers: ^ \ +[ 1-9][0-9]*$  
Verify non-zero negative integers: ^ \ – [1-9] [0-9]*$  
Verify non negative integers (positive integers + 0) ^ D+$  
Verify non positive integers (negative integers + 0) ^ ((- – D +) | (0 +))$  
Verify characters of length 3: ^. {3}$  
Verify the 26 letter string: ^ [a-za-z]+$  
Verify a string of 26 uppercase English letters: ^ [A-Z]+$  
Verify the string composed of 26 lowercase English letters: ^ [A-Z]+$  
Verify the string composed of numbers and 26 English letters: ^ [a-za-z0-9]+$  
Verify a string of numbers, 26 letters, or underscores: ^ \+$  
Verify the user password: ^ [a-za-z] [w {5,17} $the correct format is: it starts with a letter, the length is between 6-18, and can only contain characters, numbers and underscores.  
Verify whether it contains ^% & ‘; =$\“ Equal characters: [^% & ‘; =$\ x22]+  
Verification of Chinese characters: ^ [[u4e00 – [u9fa5], {0,}$  
Verify email address: / ^ ([a-za-z0-9] + [|||||||]?)*[ a-zA-Z0-9][email protected]([a-zA-Z0-9]+[_|\_|\.]?)*[ a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
Verify the Internet URL: ^ http: / / ([[w -] + \.) + [[w -] + (/ [[w -. /?%, = = *)? $^[ a-zA-z]+://(w+(-w+)*)(.(w+(-w+)*))*(? S*)?$  
Verify the phone number: ^ (\ ([D {3,4}) | [D {3,4} -)\ D {7,8} $: — the correct format is: xxx-xxxxxxxx, xxx-xxxxxxxx, xxx-xxxxxxxx, xxx-xxxxxxxx, XXXXXXXX, XXXXXXXX.  
Verify ID number (15 digit or 18 digit): ^\d{15}|\d{}18$  
12 months of validation year: ^ (0[ 1-9] | 1 [0-2]) $the correct format is: “01” – “09” and “1” “12”  
Verify the 31 days of a month: ^ ((0[ The correct format is: 01,09 and 1,31.  
Integer: ^ -\ d+$  
Non negative floating-point number (positive floating-point number + 0): ^ + D + (\. [D +)$  
Positive floating point number ^ (([0-9] + \. [0-9] * [1-9] [0-9] *) | ([0-9] * [1-9] [0-9] * \. [0-9] +) | ([0-9] * [1-9] [0-9] *)$  
Non positive floating-point number (negative floating-point number + 0) ^ ((- – D + (\. [D +)?))|( 0+(\.0+)?))$  
Negative floating point number ^ (- (([0-9] + \. [0-9] * [1-9] [0-9] *); ([0-9] * [1-9] [0-9] * \. [0-9] +); ([0-9] * [1-9] [0-9] *))$  
Floating point number ^ (-)\ d+)(\.\d+)?$