简体   繁体   中英

Regex to extract first two octets of IP address in hive

I want to extract only first two octets of IP address in hive. Can anybody please tell me equivalent Regex supported in Hive?

For example,extract '192.96.0.0' from ip_address '192.96.45.33'.

192\\.96\\.\\d{3}\\.\\d{3}

Guess this should work as Hive uses Java format.

or

192\\.96\\.(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.)(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM