= — Equality.
Selects series where the label has exactly the given value.
http_requests_total{status="200"}
!= — Negative equality.
Selects series where the label does NOT have the given value.
http_requests_total{status!="500"}
=~ — Regular expression match.
Selects series where the label value matches the regex.
http_requests_total{path=~"/api/(foo|bar)"}
!~ — Negative regular expression match.
Selects series where the label value does NOT match the regex.
Regular expressions are always fully anchored.
They match the entire label value, not just a substring. You do not need ^ or $. To match substrings, use .* on either side: