@@ -31,7 +31,7 @@ var NameRegexp = regexp.MustCompile(namePat)
3131// ReferenceRegexp is the full supported format of a reference. The regexp
3232// is anchored and has capturing groups for name, tag, and digest
3333// components.
34- var ReferenceRegexp = regexp . MustCompile ( referencePat )
34+ var ReferenceRegexp = referenceRegexp
3535
3636// TagRegexp matches valid tag names. From [docker/docker:graph/tags.go].
3737//
@@ -109,6 +109,11 @@ const (
109109)
110110
111111var (
112+ // referenceRegexp is the full supported format of a reference. The regexp
113+ // is anchored and has capturing groups for name, tag, and digest
114+ // components.
115+ referenceRegexp = regexp .MustCompile (referencePat )
116+
112117 // anchoredTagRegexp matches valid tag names, anchored at the start and
113118 // end of the matched string.
114119 anchoredTagRegexp = regexp .MustCompile (anchored (tag ))
@@ -131,7 +136,8 @@ var (
131136
132137 // anchoredNameRegexp is used to parse a name value, capturing the
133138 // domain and trailing components.
134- anchoredNameRegexp = regexp .MustCompile (anchored (optional (capture (domainAndPort ), `/` ), capture (remoteName )))
139+ anchoredNameRegexp = regexp .MustCompile (anchoredNamePat )
140+ anchoredNamePat = anchored (optional (capture (domainAndPort ), `/` ), capture (remoteName ))
135141
136142 referencePat = anchored (capture (namePat ), optional (`:` , capture (tag )), optional (`@` , capture (digestPat )))
137143
0 commit comments