mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-04 13:52:26 +08:00
26 lines
531 B
Go
26 lines
531 B
Go
// Package tools provides ...
|
|
package tools
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var regexpEmail = regexp.MustCompile(`^(\w)+([\.\-]\w+)*@(\w)+((\.\w+)+)$`)
|
|
|
|
// ValidateEmail 校验邮箱
|
|
func ValidateEmail(e string) bool {
|
|
return regexpEmail.MatchString(e)
|
|
}
|
|
|
|
var regexpPhoneNo = regexp.MustCompile(`^\+\d+$`)
|
|
|
|
// ValidatePhoneNo 校验手机号
|
|
func ValidatePhoneNo(no string) bool {
|
|
return regexpPhoneNo.MatchString(no)
|
|
}
|
|
|
|
// ValidatePassword 校验米阿莫
|
|
func ValidatePassword(pwd string) bool {
|
|
return len(pwd) > 5 && len(pwd) < 32
|
|
}
|