如何删除匹配模式的整行 [英] How to remove an entire line which matches a pattern

查看:152
本文介绍了如何删除匹配模式的整行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下模式与整行相匹配,如何搜索和删除这些行。如果我在替换字符串中留下一个空格,那么当我通过eclipse执行时,它留下一条空白。

The following pattern matches an entire line, how do I search and remove these lines. If I leave a space in the replace string, it leaves a blank in that particular line, when I do via eclipse.

^[\t ]*<param name="logic" .*$


推荐答案

我不知道有关eclipse的任何内容,但您可能需要包含 \\\
换行符,才能完全删除该行。另外 - 可以用空字符串代替空格吗?

I don't know anything about eclipse but you may need to include the \n newline match in order to remove the line completely. Also - is it possible to replace with an empty string as opposed to a space?

^[\t ]*<param name="logic" .*\n$

这篇关于如何删除匹配模式的整行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆