func NewMustRegexpMatcher(name, pattern string) Matcher {
	re, err := regexp.Compile(pattern)
	if err != nil {
		panic(err)
	}
	return &RegexpMatcher{name: name, re: re}
}
NewMustRegexpMatcher returns a new matcher verifying that a value matches
the regular expression pattern. Will panic if the pattern is not a valid
regular expression.
package labels
import (
	"fmt"
	"regexp"
)
type Selector []Matcher
func (s Selector) Matches(labels Labels) bool {
	for _, m := range s {
		if v := labels.Get(m.Name()); !m.Matches(v) {
			return false
		}
	}
	return true
}
type Matcher interface {
	Name() string
	Matches(v string) bool
	String() string
}
type EqualMatcher struct {
	name, value string
}
func (m EqualMatcher) Name() string { return m.name }
func (m EqualMatcher) Matches(v string) bool { return v == m.value }
func (m EqualMatcher) String() string { return fmt.Sprintf("%s=%q", m.name, m.value) }
func (m EqualMatcher) Value() string { return m.value }
func NewEqualMatcher(name, value string) Matcher {
	return &EqualMatcher{name: name, value: value}
}
type RegexpMatcher struct {
	name string
	re   *regexp.Regexp
}
func (m RegexpMatcher) Name() string          { return m.name }
func (m RegexpMatcher) Matches(v string) bool { return m.re.MatchString(v) }
func (m RegexpMatcher) String() string        { return fmt.Sprintf("%s=~%q", m.name, m.re.String()) }
func (m RegexpMatcher) Value() string         { return m.re.String() }
func NewRegexpMatcher(name, pattern string) (Matcher, error) {
	re, err := regexp.Compile(pattern)
	if err != nil {
		return nil, err
	}
	return &RegexpMatcher{name: name, re: re}, nil
}