I currently have formed a KQL that extracts ipv4 address from a string. similarly I would need to extract ipv6 address from the string
ipv4 extract query:
datatable (ipv4text:string)
[
'This is a random text that has IP address 128.0.0.20 that has to be extracted'
]
|extend pv4addr = extract("(([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.(([0-9]{1,3})))",1,ipv4text)
I tried the below but not sure if it covers all the edge cases
datatable (ipv6:string)
[
'IPv6 test 198.192.0.127 2345:5:2CA1:0000:0000:567:5673:256/127 in a random string'
]
|extend Ipv6Address = extract(@"(([0-9a-fA-F]{1,4}\:){7,7}[0-9a-fA-F]{1,4})|([0-9a-fA-F]{1,4}\:){1,7}\:",1,ipv6)
Can any of you one provide a complete KQL(or suggestions/hints) to extract IPV6 address?
Thanks.