Reputation: 41
I have some data in table e.g.:
id,params
123,utm_content=doit|utm_source=direct|
234,utm_content=polo|utm_source=AndroidNew|
desired data using regexp_extract:
id,channel,content
123,direct,doit
234,AndroidNew,polo
Query used:
Select id, REGEXP_extract(lower(params),'(.*utm_source=)([^\|]*)(\|*)',2) as channel, REGEXP_extract(lower(params),'(.*utm_content=)([^\|]*)(\|*)',2) as content from table;
It is showing error '* dangling meta character' and returning error code 2
Can someone help here please??
Upvotes: 2
Views: 254
Reputation: 626699
Note that in hive
, you need to double the backslashes.
Your regex should look like
(.*utm_content=)([^|]*)(\\|*)
Upvotes: 1