Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regular expression

Gor_MahiaApr 17 2025

Hi All,

I've string inputs with "|" DELIMITERS as below:

|Schreiber's Deli & Catering|Calabria Pizza|Jade Dragon|
|The Oak House|Asset Milestone|
|regulatory Filing|

I am trying to use regular expression REPLACE instead of nesting multiple normal REPLACE&TRIM functions as ive written below.

Requirement:
------------
To remove from the string the start '|' and end '|' but replace the intermediate '|' with ', '

my query gives correct output as below but i want to user REGULAR EXPRESSION instead:
select replace(ltrim(rtrim('|fhhgngng|dffngng|','|'),'|'),'|',', ') from dual ---> fhhgngng, dffngng

output from above samples:
--------------------------
|Schreibers Deli & Catering|Calabria Pizza|Jade Dragon| -------------> Schreibers Deli & Catering, Calabria Pizza, Jade Dragon
|The Oak House|Asset Milestone| -------------> The Oak House, Asset Milestone
|regulatory Filing| -------------> regulatory Filing

How can i use regular expression instead?

Oracle 12C.

thanks.

This post has been answered by Frank Kulash on Apr 17 2025
Jump to Answer
Comments
Post Details
Added on Apr 17 2025
2 comments
246 views