简体   繁体   English

如何删除具有特定字符的行

[英]How to remove a line with a certain character

I have a text like this我有这样的文字

'
blabla
blablab $!TOBEREMOVED
blabla

' '

I want to remove every lines having '$.'我想删除每一行都有“$”。 . .

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.问题是 $ allready 意味着正则表达式。 Is there a way to delete the lines with '$?'有没有办法删除带有“$”的行? ?

You may use:您可以使用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM