mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
14 lines
311 B
Go
14 lines
311 B
Go
package spdxhelpers
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var expr = regexp.MustCompile("[^a-zA-Z0-9.-]")
|
|
|
|
// SPDX spec says SPDXID must be:
|
|
// "SPDXRef-"[idstring] where [idstring] is a unique string containing letters, numbers, ., and/or -
|
|
func SanitizeElementID(id string) string {
|
|
return expr.ReplaceAllString(id, "-")
|
|
}
|