package pkg import "regexp" var ( LTMPROFILERE = regexp.MustCompile(`(?i)ltm\s+profile\s+(\S+)\s+(.*?)[ ]+{`) ) type ( LtmProfiles struct { Profiles map[string][]*string `json:"profiles"` } ) func (l *LtmProfiles) Parse(s string) { l.Profiles = make(map[string][]*string) for _, v := range LTMPROFILERE.FindAllStringSubmatch(s, -1) { // if _, ok := l.Profiles[v[1]]; !ok { // var p []*string // l.Profiles[v[1]] = p // } l.Profiles[v[1]] = append(l.Profiles[v[1]], &v[2]) } }