Illustrate use of named capturing group syntax available from https://github.com/google/re2/wiki/Syntax and their usage in the replacement field
Signed-off-by: Guillaume Berche <guillaume.berche@orange.com>
@ -292,13 +292,13 @@ For each timeseries in `v`, `label_replace(v instant-vector, dst_label string, r
matches the regular expression `regex` against the value of the label `src_label`. If it
matches the regular expression `regex` against the value of the label `src_label`. If it
matches, the value of the label `dst_label` in the returned timeseries will be the expansion
matches, the value of the label `dst_label` in the returned timeseries will be the expansion
of `replacement`, together with the original labels in the input. Capturing groups in the
of `replacement`, together with the original labels in the input. Capturing groups in the
regular expression can be referenced with `$1`, `$2`, etc. If the regular expression doesn't
regular expression can be referenced with `$1`, `$2`, etc. Named capturing groups in the regular expression can be referenced with `$name` (where `name` is the capturing group name). If the regular expression doesn't match then the timeseries is returned unchanged.
match then the timeseries is returned unchanged.
This example will return timeseries with the values `a:c` at label `service` and `a` at label `foo`:
These two examples will both return timeseries with the values `a:c` at label `service` and `a` at label `foo`: