1

To be more specific, if the original string column is like

  1. 'AAA 123 BBB 456'
  2. 'CCC 234 DDD EEE 678'
  3. 'FFFFF 7280 ZZZ 123 DDD'

what I need eventually is the first cluster of numbers only, like

  1. '123'
  2. '234'
  3. '7280'

TIA

pingboing
  • 59
  • 10

1 Answers1

0

Use regexp_extract function:

select regexp_extract('AAA 123 BBB 456','[0-9]+',0) - digit one or more times 

returns 123

leftjoin
  • 36,950
  • 8
  • 57
  • 116