You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
479 B
32 lines
479 B
2 years ago
|
/**
|
||
|
* 邮箱
|
||
|
* @param {*} s
|
||
|
*/
|
||
|
export function isEmail (s) {
|
||
|
return /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 手机号码
|
||
|
* @param {*} s
|
||
|
*/
|
||
|
export function isMobile (s) {
|
||
|
return /^1[0-9]{10}$/.test(s)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 电话号码
|
||
|
* @param {*} s
|
||
|
*/
|
||
|
export function isPhone (s) {
|
||
|
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* URL地址
|
||
|
* @param {*} s
|
||
|
*/
|
||
|
export function isURL (s) {
|
||
|
return /^http[s]?:\/\/.*/.test(s)
|
||
|
}
|