How to write a regex to parse Prometheus output

@chembakayalabharath

I want the exact regex

can you guarantee that the number section:

  1. will always begin with a number
  2. is the first time a number appears in the string?

if so you could write a regex that captures everything from the beggining of the string to the first appearance of a number:

^\D+

check out your example on regex101, which I highly recommend for figuring out regular expressions: