Skip to content

Commit

Permalink
Fix re
Browse files Browse the repository at this point in the history
  • Loading branch information
ha1287 authored and mfussenegger committed Mar 6, 2019
1 parent 59d9556 commit 178883c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func queryToSQL(q *prompb.Query) (string, error) {
selectors = append(selectors, fmt.Sprintf("(%s != %s)", escapeLabelName(m.Name), escapeLabelValue(m.Value)))
}
case prompb.LabelMatcher_RE:
re := "^(?:" + m.Value + ")$"
re := "(" + m.Value + ")"
matchesEmpty, err := regexp.MatchString(re, "")
if err != nil {
return "", err
Expand All @@ -132,7 +132,7 @@ func queryToSQL(q *prompb.Query) (string, error) {
selectors = append(selectors, fmt.Sprintf("(%s ~ %s)", escapeLabelName(m.Name), escapeLabelValue(re)))
}
case prompb.LabelMatcher_NRE:
re := "^(?:" + m.Value + ")$"
re := "(" + m.Value + ")"
matchesEmpty, err := regexp.MatchString(re, "")
if err != nil {
return "", err
Expand Down

0 comments on commit 178883c

Please sign in to comment.