Skip to content
Advertisement

Hive regexp_extract numeric value from a string

I have a table as:

I am trying to get the numeric values from the table. The expected output is

A -> 123 / B -> 124 etc

I am trying to do using regexp_extract

Any suggestions please?

Advertisement

Answer

If the delimiters are fixed – ‘; ‘ between key-value pairs and ‘=’ between key and value, you can use str_to_map function:

If you prefer regexp:

and so on

for case insensitive add (?i) to the regexp

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement