From a3dd323a533f9c06eaeb2fd7db9143d6cb18e0fe Mon Sep 17 00:00:00 2001 From: SuperQ Date: Mon, 10 Jan 2022 16:44:24 +0100 Subject: [PATCH] Make regex-matching docs more obvious Split out the note about regex-matching into a separate paragraph to make it more obvious. Move it up, closer to the definition. Signed-off-by: SuperQ --- docs/querying/basics.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/querying/basics.md b/docs/querying/basics.md index 8a74f0df5..108288f66 100644 --- a/docs/querying/basics.md +++ b/docs/querying/basics.md @@ -104,14 +104,15 @@ against regular expressions. The following label matching operators exist: * `=~`: Select labels that regex-match the provided string. * `!~`: Select labels that do not regex-match the provided string. +Regex matches are fully anchored. A match of `env=~"foo"` is treated as `env=~"^foo$"`. + For example, this selects all `http_requests_total` time series for `staging`, `testing`, and `development` environments and HTTP methods other than `GET`. http_requests_total{environment=~"staging|testing|development",method!="GET"} Label matchers that match empty label values also select all time series that -do not have the specific label set at all. Regex-matches are fully anchored. It -is possible to have multiple matchers for the same label name. +do not have the specific label set at all. It is possible to have multiple matchers for the same label name. Vector selectors must either specify a name or at least one label matcher that does not match the empty string. The following expression is illegal: