hive函数 regexp_extract实践

来源:互联网 发布:seo网站内部优化 编辑:程序博客网 时间:2024/04/29 14:51

      在使用hive中函数regexp_extract需要注意的是正则表达式的\需要使用\进行转义,也就是说,需要使用\\两道斜线。

      使用案例:

      提取数字:
select regexp_extract('4.2.3.','\\d',0) from error_20111101 limit 4;

    提取版本信息:

select regexp_extract('4.2.3.','[\\d+\\.]+',0) from error_20111101 limit 4;select regexp_extract('a4.2.3.','[\\d+\\.]+',0) from error_20111101 limit 4;



原创粉丝点击