Extending label.Parse method to support exact match

This commit is contained in:
Salvatore Dario Minonne
2015-02-15 00:07:30 +01:00
parent 86434b4038
commit 0186acc37c
4 changed files with 854 additions and 246 deletions

View File

@@ -103,3 +103,13 @@ func IsQualifiedName(value string) bool {
}
return true
}
const LabelValueFmt string = "([A-Za-z0-9_\\-\\\\.]*)"
var labelValueRegexp = regexp.MustCompile("^" + LabelValueFmt + "$")
const labelValueMaxLength int = 63
func IsValidLabelValue(value string) bool {
return (len(value) <= labelValueMaxLength && labelValueRegexp.MatchString(value))
}