parent
622fa89ac6
commit
db8ce0e625
2 changed files with 3 additions and 3 deletions
4
email.go
4
email.go
|
|
@ -16,7 +16,7 @@ const ResultNotEmail = "NOT_EMAIL"
|
|||
const ipV6Prefix = "[IPv6:"
|
||||
|
||||
// notQuotedChars is the valid not quoted characters.
|
||||
var notQuotedChars = regexp.MustCompile("[a-zA-Z0-9!#$%&'*+-/=?^_`{|}~]")
|
||||
var notQuotedChars = regexp.MustCompile("[a-zA-Z0-9!#$%&'*\\+\\-/=?^_`{|}~]")
|
||||
|
||||
// IsEmail checks if the given string is an email address.
|
||||
func IsEmail(email string) Result {
|
||||
|
|
@ -33,7 +33,7 @@ func IsEmail(email string) Result {
|
|||
user := email[:atIndex]
|
||||
|
||||
// Cannot be empty user
|
||||
if len(user) == 0 || len(user) > 64 {
|
||||
if user == "" || len(user) > 64 {
|
||||
return ResultNotEmail
|
||||
}
|
||||
|
||||
|
|
|
|||
2
fqdn.go
2
fqdn.go
|
|
@ -13,7 +13,7 @@ const CheckerFqdn = "fqdn"
|
|||
const ResultNotFqdn = "NOT_FQDN"
|
||||
|
||||
// Valid characters excluding full-width characters.
|
||||
var fqdnValidChars = regexp.MustCompile("^[a-z0-9\u00a1-\uff00\uff06-\uffff-]+$")
|
||||
var fqdnValidChars = regexp.MustCompile("^[a-z0-9\u00a1-\uff00\uff06-\uffff\\-]+$")
|
||||
|
||||
// IsFqdn checks if the given string is a fully qualified domain name.
|
||||
func IsFqdn(domain string) Result {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue