Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to remove a line with a certain character

I have a text like this

'
blabla
blablab $!TOBEREMOVE
blabla

I want to remove every lines having ‘$!’ .

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

therefore my example become that

'
blabla
blabla

I would like to use something like that:

SELECT REGEXP_REPLACE (inhalt,'(' || chr(10) || '.$!.' || chr(10) || ')',''

It doesn’t remove the line. The problem is that $ allready means something for regex.
Is there a way to delete the lines with ‘$!’ ?

>Solution :

You may use:

SELECT inhalt,
       TRIM(REGEXP_REPLACE(inhalt, '(^|' || chr(10) || ').*\$!.*($|' ||
           chr(10) || ')', chr(10))) AS inhalt_out
FROM yourTable;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading