Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In NotePad++ how do I turn this:

GingeredRovinsky7|NTDc4MAODY3Mg|

into this:

GingeredRovinsky7=NTDc4MAODY3Mg

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?

share|improve this question

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

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

add comment

2 Answers 2

up vote 4 down vote accepted

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:

\1=\2

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.