github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/format/internal/spdxutil/helpers/spdxid.go (about) 1 package helpers 2 3 import ( 4 "regexp" 5 ) 6 7 var expr = regexp.MustCompile("[^a-zA-Z0-9.-]") 8 9 // SPDX spec says SPDXID must be: 10 // "SPDXRef-"[idstring] where [idstring] is a unique string containing letters, numbers, ., and/or - 11 func SanitizeElementID(id string) string { 12 return expr.ReplaceAllString(id, "-") 13 }