Replace every nth instance of a character with a new line in Notepad++

notepadregexstring manipulation

I have a pipe delimited string of NAME|VALUE pairs looking something like this..

Name1|Value1|Name2|Value2|Name3|Value3

What I want to do is to replace every second instance of | with a new line so that I have something like this..

Name1|Value1
Name2|Value2
Name3|Value3

My issue isn't the new-line, as I know I can use \r\n for that, but rather the regex part that only replaces every second instance of |.

Best Answer

Find: ([^\|]*\|[^\|]*)\|
Replace to: \1\n

Related Question