Skip to content

Instantly share code, notes, and snippets.

@xigang
Last active March 10, 2016 06:53
Show Gist options
  • Select an option

  • Save xigang/3c1b25b34398f6537e22 to your computer and use it in GitHub Desktop.

Select an option

Save xigang/3c1b25b34398f6537e22 to your computer and use it in GitHub Desktop.
对中国手机号的校验
const (
regular = "^(1[3-8][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)
}
@xigang
Copy link
Author

xigang commented Feb 29, 2016

对中国手机号的校验

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment