github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/utils/names.go (about)

     1  package utils
     2  
     3  import "regexp"
     4  
     5  // RestrictedNameChars collects the characters allowed to represent a name, normally used to validate container and volume names.
     6  const RestrictedNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.-]`
     7  
     8  // RestrictedNamePattern is a regular expression to validate names against the collection of restricted characters.
     9  var RestrictedNamePattern = regexp.MustCompile(`^/?` + RestrictedNameChars + `+$`)
    10  
    11  // RestrictedVolumeNamePattern is a regular expression to validate volume names against the collection of restricted characters.
    12  var RestrictedVolumeNamePattern = regexp.MustCompile(`^` + RestrictedNameChars + `+$`)