1

I am trying to parse a word before ':' character. I mean i want to get 10.10.10.10 from 10.10.10.10:9445. I tried on regex101. It worked there. But couldn't get what i want on grafana.I searched and tried but couldn't achieve what i want. Grafana doesn't throw error on that regex but also doesn't return result.

Can someone please let me know what causes this ?

Similar question

rmznbyk 1
  • 974
  • 2
  • 12
  • 22

1 Answers1

1

You need to use a regex that matches the full string and use a capturing group around the part of pattern you need to get:

([^:]+):.*

It will match and capture any 1 or more chars other than : from the start of the string till the first :, then will match : and any 0 or more chars other than line break chars till end of the string (with no linebreaks).

See the regex demo.

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476