Files
gemini-banlancer/internal/utils/validators.go
2025-11-20 12:24:05 +08:00

21 lines
514 B
Go

// Filename: internal/utils/validators.go
package utils
import "regexp"
const MaxGroupNameLength = 32
// groupNameRegex validates that a group name consists only of lowercase letters, numbers, and hyphens.
var groupNameRegex = regexp.MustCompile(`^[a-z0-9-]+$`)
// IsValidGroupName checks if the provided string is a valid group name.
func IsValidGroupName(name string) bool {
if name == "" {
return false
}
if len(name) > MaxGroupNameLength {
return false
}
return groupNameRegex.MatchString(name)
}