Reputation: 2016
I have the below string:
rollover#7500,another1#3000,another2#4000, another1#7000
I need to extract the number that comes directly after rollover#
So far, I have this, but it's matching rollover#7500
(?:rollover#[0-9]*)
I'm not sure how to extract only the numbers?
I will be running this in a Hive query
Upvotes: 1
Views: 88
Reputation: 626929
You may use
regexp_extract(your_col,'rollover#([0-9]+)', 1)
The rollover#([0-9]+)
pattern will find rollover#
and then will capture 1 or more digits into Group 1, the third 1
argument will make regexp_extract
return just the Group 1 value.
Upvotes: 1