rmznbyk 1
rmznbyk 1

Reputation: 1216

Grafana Regex Issue

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

Upvotes: 1

Views: 1397

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627607

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.

Upvotes: 1

Related Questions