Password regular (alphanumeric only) :

/^[A-Za-z0-9]+$/;
Copy the code

Input Chinese characters only:

/^[\u2E80-\u9FFF]+$/
Copy the code

Verify ID number (both 15-digit first-generation ID card and 18-digit second-generation ID card are included) :

 /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
Copy the code

Input Chinese characters only:

/ ^ [0-9] + $/Copy the code

Combination of numbers, letters and Chinese characters:

/^[A-Za-z0-9\u4e00-\u9fa5]+$/
Copy the code

Email verification:

/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
Copy the code

Land line:

/ ^ 0 \ d {2, 3} -? \ d {7, 8} $/Copy the code

Mobile phone no. :

,4,5,7,8 / ^ [1] [3] [0-9] {9} $/Copy the code

Space:

/\s/
Copy the code

Usage: Example:

var svgg =/\s/;
var str =$("#ccc").val(); // What to validate svgg.test(STR);Copy the code