>我在表格中有一些数据,例如:
id,params
123,utm_content=doit|utm_source=direct|
234,utm_content=polo|utm_source=AndroidNew|
使用regexp_extract所需的数据:
id,channel,content
123,direct,doit
234,AndroidNew,polo
使用的查询:
Select id, REGEXP_extract(lower(params),'(.*utm_source=)([^|]*)(|*)',2) as channel, REGEXP_extract(lower(params),'(.*utm_content=)([^|]*)(|*)',2) as content from table;
它显示错误"* 悬空元字符"并返回错误代码 2
有人可以在这里帮忙吗?
请注意,在 hive
中,您需要加倍反斜杠。
您的正则表达式应如下所示
(.*utm_content=)([^|]*)(\|*)