i have this string
grafana-stack_alloy
and require everything after the first underscore
alloy
.
I need the result as a group $1
. Tried this one, but it failed. (?:)?([^_]+)*$
.
Can anyone help me to solve this problem?
I am testing this:
rule {
action = "replace"
source_labels = [
"__meta_docker_container_label_com_docker_swarm_service_name",
]
regex = "^(?:;*)?([^;]+).*$" work but wrong
//regex = "[^_]+.$" ----> not work
//regex = "([^_]+)$" ----> not work
replacement = argument.namespace.value + "/$1"
target_label = "job"
}
It is about the Grafana Agent with relabel-regex:
Grafana prometheus.relabel which use [Google's RE2](https://github.com/google/re2/wiki/Syntax) as its regex engine.
Thanks in advance
Asked by user2931829
(3 rep)
Dec 23, 2024, 10:23 AM
Last activity: Dec 24, 2024, 09:48 AM
Last activity: Dec 24, 2024, 09:48 AM