internal/diskutil/identifier/disk.go (12 lines of code) (raw):
package identifier
import (
"regexp"
"strings"
)
// diskIDExp is the regexp expression for device identifiers.
var diskIDExp = regexp.MustCompile("disk[0-9]+")
// ParseDiskID parses a supported disk identifier from a string.
func ParseDiskID(s string) string {
if strings.TrimSpace(s) == "" {
return ""
}
return diskIDExp.FindString(s)
}