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

  1. /**
  2. * 邮箱
  3. * @param {*} s
  4. */
  5. export function isEmail (s) {
  6. return /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
  7. }
  8. /**
  9. * 手机号码
  10. * @param {*} s
  11. */
  12. export function isMobile (s) {
  13. return /^1[0-9]{10}$/.test(s)
  14. }
  15. /**
  16. * 电话号码
  17. * @param {*} s
  18. */
  19. export function isPhone (s) {
  20. return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
  21. }
  22. /**
  23. * URL地址
  24. * @param {*} s
  25. */
  26. export function isURL (s) {
  27. return /^http[s]?:\/\/.*/.test(s)
  28. }