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!

Remove strings between and including the signs < >

Youssef_B_82Jun 14 2018 — edited Jun 20 2018

Hi

I need to remove strings between the signs <> including the signs themselves

For example

<%text%> My receipt image text <%someothertext%>

the expected results would be

My receipt image tex

right now I am using the replace function as follow

SELECT REPLACE(REPLACE(REPLACE(

      (REPLACE(

      (REPLACE(

      (REPLACE(

      (REPLACE(

      ((REPLACE(

      (REPLACE( (SUBSTR(r.text, 1, instr(r.text, '<%RECEIPTCUT%>')-1)),'<%RECEIPTSELECT%>',''))

      ,'<%LOGO%>','')))

      ,'<%BOLD%>',''))

      ,'<%/BOLD%>',''))

      ,'<%BIG%>',''))

      ,'<%/BIG%>',''))

      ,'<%REPRINT_R%>','')

      ,'<%/BARCODE%>','')

      ,'<%BARCODE%>','') RECEIPT

FROM RECEIPTIMAGE R

this method works but it gets messy and the problem is when the receipt format changes I need to fix it manually.

The pattern is always like this:

<%TEXT%>

where TEXT changes but not the <% %>

Is there a way to find the pattern and remove whats inside including the signs..

Thanks

Youssef

This post has been answered by Paulzip on Jun 14 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2018
Added on Jun 14 2018
25 comments
949 views