Karthik
Karthik

Reputation: 145

PL/SQL: REGEXP REPLACE with dot and pattern

I am trying to replace the string using regexp_replace in PLSQL and not getting desired output. i am new to this. please advise where i am going wrong.

names := 'table_200_file1_record1.column1   table_200_file2_record2.column2'
SELECT REGEXP_REPLACE(names,'([table_200]*[.]*){1,}','') FROM DUAL;

Desired output: (i want to remove everything before . operator which is starting with table_200)

column1 column2

Upvotes: 0

Views: 632

Answers (1)

pablomatico
pablomatico

Reputation: 2242

You need to replace everything that's not a dot after table_200, up to the first dot you find, i.e.:

SELECT REGEXP_REPLACE('table_200_file1_record1.column1   table_200_file2_record2.column2','table_200[^\.]+(\.)','') FROM DUAL

Upvotes: 1

Related Questions