This is how I’m turning any tags into a simple map of strings (in Go, but it’s just an example of simple string splits).
This is after splitting out the tag part of the message, not including @
or trailing space
.
func tagsToMap(tagString string) map[string]string {
result := make(map[string]string)
splitTags := strings.Split(tagString, ";")
for _, tag := range splitTags {
splitTag := strings.SplitN(tag, "=", 2)
result[splitTag[0]] = splitTag[1]
}
return result
}
Then no matter if tags are added or removed or which order they are in, we have a simple map that we can use instead of unwieldy regex. (The example should properly catch any tags as defined by specification).