Question

I want to delete all lines ending with |

I tried

.*[|;]

but it's not the end

Was it helpful?

Solution

Use the following regex:

.*\|$

This says "any character any number of times (.*), followed by a pipe (\| - you have to escape it), and then the end of a line ($)".

If you want to find lines ending with either ; or |, use:

.*[\|;]$

You don't have to escape the pipe in this case, but I prefer to do so anyway.

In either case, make sure you're in "Regular expression" search mode with ". matches newline" unchecked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top