Adithya Kumar
Adithya Kumar

Reputation: 159

regexp_extract not working

I have the string Created RSA Key 1234 from Intelligent Expense ID 54678||||||"

and I need to extract 54678 in Hive QL. I am using this

select description,regexp_extract(description,'ID\s(\d*)\|') as cctkey from smartmatching limit 10

I tested the regex and it looks fine. But hive does not return any output for me. It is showing NULL. Can somebody help

Upvotes: 0

Views: 1059

Answers (1)

rock321987
rock321987

Reputation: 11032

You need to escape the \s, \d and \|. It should be

ID\\s(\\d*)\\|

Upvotes: 2

Related Questions