Home >Web Front-end >JS Tutorial >Summary of commonly used regular expressions
Commonly used regular expressions:
/^\w+([-+.']\w+)*\w+([-.]\w+)*\.\w+([-.]\w+)*$/ :电子邮箱 /^1[0-9]{10}$/ : 手机号码11位 /^(1[0-9]{10}|\w+([-+.']\w+)*\w+([-.]\w+)*\.\w+([-.]\w+))*$/ : 手机号码11位或者是电子邮箱
^[0-9a-zA-Z]+$: can only be pure numbers, pure letters or a combination of numbers and letters
^(?!\d+$)[\da-zA-Z]*$: It cannot be pure numbers, it can be pure letters, or it can be a combination of letters and numbers
var da = /^[0-9a-zA-Z]+$/;if (!da.test("需要匹配的字符串")) { layer.tips('请输入数字和字母组合', $(this), { tips: [1, '#3595CC'], time: 4000 }); Success = false; }
The above is the detailed content of Summary of commonly used regular expressions. For more information, please follow other related articles on the PHP Chinese website!