github.com/dougm/docker@v1.5.0/registry/v2/regexp.go (about)

     1  package v2
     2  
     3  import "regexp"
     4  
     5  // This file defines regular expressions for use in route definition. These
     6  // are also defined in the registry code base. Until they are in a common,
     7  // shared location, and exported, they must be repeated here.
     8  
     9  // RepositoryNameComponentRegexp restricts registtry path components names to
    10  // start with at least two letters or numbers, with following parts able to
    11  // separated by one period, dash or underscore.
    12  var RepositoryNameComponentRegexp = regexp.MustCompile(`[a-z0-9]+(?:[._-][a-z0-9]+)*`)
    13  
    14  // RepositoryNameRegexp builds on RepositoryNameComponentRegexp to allow 2 to
    15  // 5 path components, separated by a forward slash.
    16  var RepositoryNameRegexp = regexp.MustCompile(`(?:` + RepositoryNameComponentRegexp.String() + `/){1,4}` + RepositoryNameComponentRegexp.String())
    17  
    18  // TagNameRegexp matches valid tag names. From docker/docker:graph/tags.go.
    19  var TagNameRegexp = regexp.MustCompile(`[\w][\w.-]{0,127}`)