In NotePad++ how do I turn this:


into this:


I know I can do a find and replace and replace the first | with =

However I need to strip the last | from each line as well.

How do I do this?

migrated from stackoverflow.com Aug 15 '11 at 4:25

This question came from our site for professional and enthusiast programmers.


If every line is going to consist of exactly two | characters in that format, I should think this regex find-and-replace will do it.

Find all:


Replace all with:



Notepad++ supports extended and regular expression search and replace. Using the extended search and replace you could do this in two passes.

In the first pass replace the trailing | by searching for |\r and replacing with \r:

enter image description here

In the second pass we replace the middle | by doing a normal search and replace.

This of course assumes that your line ends are \r\n.


You can use a regular expression at the replace dialog.



Replace with nothing Then just select Replace All

Full options are: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy