Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^([^;,\n]*)(;.*(\1)(,.*|;)?|;;)$
/
gm

Description

relabel_configs:
  # allow override of default /probe path, specifying the annotation will limit the targets to those paths
  #  exclusively, a comma-delimited list convention of /foo,/bar is supported
  #
  #   metrics.agent.grafana.com/path: /~/ready,/ping,/~/healthy,/health/up
  #   prometheus.io/path: /~/ready,/ping,/~/healthy,/health/up
  #
  - action: keep
    source_labels:
      - __meta_kubernetes_ingress_path
      - __meta_kubernetes_ingress_annotation_metrics_agent_grafana_com_path
      - __meta_kubernetes_ingress_annotation_prometheus_io_path
    separator: ;
    regex: ^([^;,\n]*)(;.*(\1)(,.*|;)?|;;)$
Submitted by AaronB - 2 years ago