首页 > 解决方案 > 配置单元中的无效函数 regex_extract

问题描述

尝试在配置单元中执行查询:

select regex_extract(col,'regex',1) from tbl;

验证我使用的正则表达式是正确的。

错误:

FAILED: SemanticException [Error 10011]: Invalid function regex_extract

标签: hive

解决方案


Consider using regexp_extract instead of regex_extract in Hive. Below is the right syntax for the regexp_extract:

regexp_extract(string subject, string pattern, int index)

Below is an example from hive docs

regexp_extract('foothebar', 'foo(.*?)(bar)', 2) returns 'bar.'

推荐阅读