简体   繁体   English

正则表达式提取配置单元中IP地址的前两个八位字节

[英]Regex to extract first two octets of IP address in hive

I want to extract only first two octets of IP address in hive. 我只想在蜂巢中提取IP地址的前两个八位字节。 Can anybody please tell me equivalent Regex supported in Hive? 有人可以告诉我Hive支持的同等Regex吗?

For example,extract '192.96.0.0' from ip_address '192.96.45.33'. 例如,从ip_address'192.96.45.33'提取'192.96.0.0'。

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

Guess this should work as Hive uses Java format. 猜猜这应该在Hive使用Java格式时起作用。

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]?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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