diff --git a/lib/promrelabel/config.go b/lib/promrelabel/config.go index 5a5d602861..ec0fc91f93 100644 --- a/lib/promrelabel/config.go +++ b/lib/promrelabel/config.go @@ -63,7 +63,7 @@ func parseRelabelConfig(dst []ParsedRelabelConfig, rc *RelabelConfig) ([]ParsedR if rc.Regex != nil { regex := *rc.Regex if rc.Action != "replace_all" && rc.Action != "labelmap_all" { - regex = "^" + *rc.Regex + "$" + regex = "^(?:" + *rc.Regex + ")$" } re, err := regexp.Compile(regex) if err != nil {