Suppose I want to delete all lines matching a regular expression in my project. Is there any way to do this?
Using a global search and replace function with regular expressions enabled, I tried:
Replace with foo|baran empty string. This does not work because it leaves a line there with an empty line. I want the new line to be deleted.
Replace with (foo|bar)\nan empty string. It really doesn't match anything.
Replace with (foo|bar)$an empty string. Again, nothing matches.
Any ideas?
Change . It looks like some of my files have Windows line endings, so it (foo|bar)\r?\nmatches. However, when you replace it with an empty string, in fact it still leaves the end of the string.
Here's a test case:
a
foo
b
This should end as follows:
a
b
Not this way:
a
b
source
share