mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-19 18:47:05 +00:00
Change regexp pattern
This commit is contained in:
14
valid.go
14
valid.go
@@ -18,35 +18,35 @@ var (
|
|||||||
|
|
||||||
// validDomainName returns true if the input is correct format.
|
// validDomainName returns true if the input is correct format.
|
||||||
func validDomainName(name string) bool {
|
func validDomainName(name string) bool {
|
||||||
return regexp.MustCompile(`^([A-Za-z0-9][A-Za-z0-9\-]{1,61}[A-Za-z0-9]\.)*[A-Za-z]+$`).MatchString(name)
|
return regexp.MustCompile(`^([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasDomainName returns true if the input is correct format.
|
// validAliasDomainName returns true if the input is correct format.
|
||||||
func validAliasDomainName(name string) bool {
|
func validAliasDomainName(name string) bool {
|
||||||
return regexp.MustCompile(`^([A-Za-z0-9][A-Za-z0-9\-]{1,61}[A-Za-z0-9]\.)*[A-Za-z]+$`).MatchString(name)
|
return regexp.MustCompile(`^([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasDomainTarget returns true if the input is correct format.
|
// validAliasDomainTarget returns true if the input is correct format.
|
||||||
func validAliasDomainTarget(target string) bool {
|
func validAliasDomainTarget(target string) bool {
|
||||||
return regexp.MustCompile(`^([A-Za-z0-9][A-Za-z0-9\-]{1,61}[A-Za-z0-9]\.)*[A-Za-z]+$`).MatchString(target)
|
return regexp.MustCompile(`^([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validUserName returns true if the input is correct format.
|
// validUserName returns true if the input is correct format.
|
||||||
func validUserName(name string) bool {
|
func validUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasUserName returns true if the input is correct format.
|
// validAliasUserName returns true if the input is correct format.
|
||||||
func validAliasUserName(name string) bool {
|
func validAliasUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validAliasUserTarget returns true if the input is correct format.
|
// validAliasUserTarget returns true if the input is correct format.
|
||||||
func validAliasUserTarget(target string) bool {
|
func validAliasUserTarget(target string) bool {
|
||||||
return regexp.MustCompile(`^[^\s]+@([A-Za-z0-9][A-Za-z0-9\-]{1,61}[A-Za-z0-9]\.)*[A-Za-z]+$`).MatchString(target)
|
return regexp.MustCompile(`^[^\s@]+@([A-Za-z0-9\-]+\.)*[A-Za-z]+$`).MatchString(target)
|
||||||
}
|
}
|
||||||
|
|
||||||
// validCatchAllUserName returns true if the input is correct format.
|
// validCatchAllUserName returns true if the input is correct format.
|
||||||
func validCatchAllUserName(name string) bool {
|
func validCatchAllUserName(name string) bool {
|
||||||
return regexp.MustCompile(`^[^\s]+$`).MatchString(name)
|
return regexp.MustCompile(`^[^\s@]+$`).MatchString(name)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user