Reputation: 651
I want to parse out negative decimal values in a expression in Hive and I have written the following regex,
select regexp_extract("abcsdfghj-117.3700631&poikse-118.244&",
'([-][1-9][0-9]*[.][0-9]+)&*') as output
While the regex seems to work well, it gives me only the first match of it. Is it possible to make hive give out all possible combinations ? Is there any function in hive to make that return all the matches?
I did google this and I was not able to find any answer. Any help would be appreciated
Thanks
Upvotes: 2
Views: 8367
Reputation: 44941
{prefix}{number}&
with ,{number}
,
),
hive> select split(substr(regexp_replace("abcsdfghj-117.3700631&poikse-118.244&",'.*?(-\\d+\\.\\d+)&',',$1'),2),',') as output;
OK
["-117.3700631","-118.244"]
Upvotes: 8