简体   繁体   中英

Hive query to get the value for a given key in String

I am using regexp_extract for getting sub-string from a string

My string is ":abd: 576892034 :erg: 94856023MXCI :oute: A RF WERS YUT :oowpo: 649217349GBT GB"

How will get this using regexp_extract function.

I need the value as 576892034 if i pass the key as abd Any other function also fine.

select
  regexp_extract(
    ':adb: 576892034 :erg: 94856023MXCI :oute: A RF WERS YUT :oowpo: 649217349GBT GB',
    ':oute: ((?:.(?!:))+)',
    1
  )

manual : cloudera docs

example of regex : regex101

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM