1234567891011121314151617181920 |
- package libs
- import "regexp"
- type IValidate struct {
- }
- func Validate() (*IValidate) {
- return new(IValidate)
- }
- // 验证手机号码
- func (*IValidate)IsPhone(phone string)(bool) {
- regular := "^(13[0-9]|14[57]|15[0-35-9]|18[07-9])\\\\d{8}$"
- reg := regexp.MustCompile(regular)
- return reg.MatchString(phone)
- }
|