golang实现验证电子信箱和手机格式合法性(正则表达式)

邮箱验证

func checkEmail(email string) (b bool) {
 if m, _ := regexp.MatchString("^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+", email); !m {
 return false
 }
 return true
 }

手机验证

package main
import (
 "regexp"
)

const (
 regular = "^(13[0-9]|14[57]|15[0-35-9]|18[07-9])\\d{8}$"
)

func validate(mobileNum string) bool {
 reg := regexp.MustCompile(regular)
 return reg.MatchString(mobileNum)
}

func main() {
 if validate("13888888888") {
 println("是手机号")
 return
 }

 println("不是手机号")
}

45 thoughts on “golang实现验证电子信箱和手机格式合法性(正则表达式)

  1. Pingback: Dentist in Thornton CO

  2. Pingback: didi

  3. Pingback: education essay writing

  4. Pingback: 바카라사이트

  5. Pingback: http://www.sandpfamilycontracting.com/usa/home-remodeling-services/

  6. Pingback: hifu

  7. Pingback: 우리카지노

  8. Pingback: fun88asia

  9. Pingback: คาสิโน

  10. Pingback: Eddie Frenay

  11. Pingback: ร้านเช่าชุดราตรี สุรินทร์

  12. Pingback: cbd-campus

  13. Pingback: keo truc tuyen

  14. Pingback: สูตรหวยยี่กี excel

  15. Pingback: estared.net

  16. Pingback: wcasino88

  17. Pingback: 안전카지노

  18. Pingback: CBD

  19. Pingback: Research

  20. Pingback: एक्स एक्स एक्स वीडियो

  21. Pingback: 더블업카지노 【 CGV000.COM 】

  22. Pingback: best online casino malaysia

  23. Pingback: Dental Implants Cost First Class Dental Care

  24. Pingback: https://przedszkolelidzbark.pl/

  25. Pingback: 토토먹튀 신고

  26. Pingback: richard mille rm 032 replica watch

  27. Pingback: 바카라 사이트 가입 쿠폰

  28. Pingback: Stiiizy

  29. Pingback: ciprofloxacin price without insurance

  30. Pingback: seo prutser

  31. Pingback: Homepage

  32. Pingback: London Massage Hire

  33. Pingback: huge boobs live cam chat

  34. Pingback: bimatoprost ophthalmic solution 0.03% generic

  35. Pingback: copy rolex datejust reviews

  36. Pingback: buy cheap viagra now

  37. Pingback: buy hydroxychloroquine online

  38. Pingback: cheap wigtype

  39. Pingback: 먹튀헌터

  40. Pingback: English To Russian Translation

  41. Pingback: lo de online

  42. Pingback: 100mg generic sildenafil lowest price

  43. Pingback: buy cialis

  44. Pingback: droga5.net

  45. Pingback: buy Liberty Caps (psilocybe semilanceata) mushrooms online for sale near me in USA Canada UK Australia overnight delivery cheap

Comments are closed.