nginx-ui/internal/validation/alphanumdash.go

10 lines
213 B
Go

package validation
import (
val "github.com/go-playground/validator/v10"
"regexp"
)
func alphaNumDash(fl val.FieldLevel) bool {
return regexp.MustCompile(`^[a-zA-Z0-9-]+$`).MatchString(fl.Field().String())
}