Question

regexp_sustr Logic not working

  • 21 February 2022
  • 1 reply
  • 40 views

Userlevel 1
Badge +3

Hi Team,

 

I want to extract a particular word from a string, I am using “regexp_substr”, but its not giving result as expected.

 

TAB_NAME : Test TABLE IC_X_CUST_HEADER_F_123_TAB A, CUSTOMER_ORDER B, LEFTJOIN (PURHCASE_ORDER_LINE)

 

From above text, I want to extract the word ‘IC_X_CUST_HEADER_F_123_TAB” , so I wrote below logic.

 

SELECT 
regexp_substr(t.tab_name,
'ic_[A-z]+[0-9]+) AS output FROM IC_TAB_LIST t;

 

But, its not giving result.

 

can anyone suggest ?

 

Thanks,

Srini 

 


This topic has been closed for comments

1 reply

Userlevel 7
Badge +18

Hi @TechSriniG 
seems your regexp_substr statement is not a completed one.

Try below

SELECT regexp_substr(t.tab_name,
'IC_[A-z]+[0-9]+_[A-z]+') AS output FROM IC_TAB_LIST t;

I tried as below