regex.go 405 B

12345678910111213141516
  1. package controller
  2. import (
  3. "errors"
  4. "regexp"
  5. )
  6. var (
  7. errInvalidNodeName = errors.New("Node name must be alphanumderic and/or dashes")
  8. errInvalidExtClientID = errors.New("Ext client ID must be alphanumderic and/or dashes")
  9. )
  10. // allow only dashes and alphaneumeric for ext client and node names
  11. func validName(name string) bool {
  12. return regexp.MustCompile("^[a-zA-Z0-9-]+$").MatchString(name)
  13. }