I'm trying to extract a word from a string using Oracle 12c regexp_substr but no luck in understanding how it works, too much info in the net and I get confused.
So I want to extract tmp* tables from a string:
query_str:
select
column1 c1,
column2 c2
from tmp_123 foo1, -- some comments here
TAB1_123 TAB1
where 1=1
;
Trying to use this but no "luck":
select regexp_substr(query_str, 'TMP_[A-z]+', 1, 1, 'i');
I want to extract until the space and the tmp table name can have numbers in the middle like this: tmp_123.
Any suggestion?