Skip to content
Advertisement

How to get text among in blanket [] (Presto)

How to get the result ‘xxx’ from blanket [ ] in presto. I can’t find the proper regexp to fix my problem

select aaa_[xxx]

Could you help me out?

Thank you

Advertisement

Answer

If you have strings like this: and want to extract substring between square brackets, use this:

select regexp_extract('aaa_[xxx]','.*?[(.*?)]',1) --returns xxx
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement