Add mail validate util.
This commit is contained in:
parent
ff864ff9d2
commit
452c48c17e
10
rest/util_validation.go
Normal file
10
rest/util_validation.go
Normal file
@ -0,0 +1,10 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func ValidateEmail(email string) bool {
|
||||
emailRegexp := regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
|
||||
return emailRegexp.MatchString(email)
|
||||
}
|
Loading…
Reference in New Issue
Block a user