説明なし

validate.js 969B

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Created by jiachenpan on 16/11/18.
  3. */
  4. /* 是否是公司邮箱*/
  5. export function isWscnEmail(str) {
  6. const reg = /^[a-z0-9](?:[-_.+]?[a-z0-9]+)*@wallstreetcn\.com$/i
  7. return reg.test(str.trim())
  8. }
  9. /* 合法uri*/
  10. export function validateURL(textval) {
  11. const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
  12. return urlregex.test(textval)
  13. }
  14. /* 小写字母*/
  15. export function validateLowerCase(str) {
  16. const reg = /^[a-z]+$/
  17. return reg.test(str)
  18. }
  19. /* 大写字母*/
  20. export function validateUpperCase(str) {
  21. const reg = /^[A-Z]+$/
  22. return reg.test(str)
  23. }
  24. /* 大小写字母*/
  25. export function validatAlphabets(str) {
  26. const reg = /^[A-Za-z]+$/
  27. return reg.test(str)
  28. }