3
0
corteza/pkg/handle/handle.go
2019-09-30 10:20:39 +02:00

14 lines
197 B
Go

package handle
import (
"regexp"
)
var (
c = regexp.MustCompile(`^[A-Za-z][0-9A-Za-z_\-.]*[A-Za-z0-9]$`)
)
func IsValid(s string) bool {
return s == "" || (len(s) >= 2 && c.MatchString(s))
}