| | |
| | | return urlregex.test(textval) |
| | | } |
| | | // 校验汉字名 |
| | | export function validateName(str){ |
| | | |
| | | export function validateName(str) { |
| | | const rep = /^[\u4E00-\u9FA5]{2,4}$/; |
| | | return rep.test(str); |
| | | } |
| | | // 校验手机号 |
| | | export function validatePhone(str){ |
| | | export function validatePhone(str) { |
| | | const phoneRep = /(^1[3|4|5|7|8|9]\d{9}$)|(^09\d{8}$)/; |
| | | return phoneRep.test(str); |
| | | } |
| | | |
| | | // 校验邮箱 |
| | | export function validateEmail(str) { |
| | | const rep = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/; |
| | | return rep.test(str); |
| | | } |
| | | // |
| | | |