I want to get 10.10.10.10
from 10.10.10.10:9445
, i.e. parsing before the :
.
I tried on regex101 using: (.+?((?=:)))
and it worked there. But couldn't get what I want on Grafana.
It doesn't throw error on that regex but also doesn't return result.
Can someone please let me know what causes this ?
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.