mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-04 13:52:26 +08:00
chore: trash
This commit is contained in:
23
tools/validate.go
Normal file
23
tools/validate.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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
|
||||
}
|
||||
Reference in New Issue
Block a user