Move character to end of previous line
-
Hi. I’m trying to move the pipe on the new line to the end of the previous line, for example -
233307|35|ABCD|00001111|01/03/2016|||n|n|AB/123456 | 233307|36|ABCD|00002222|01/03/2016|||n|n|AB/123456 | 233307|37|DCBAL|00003333|01/03/2016|||n|n||
to -
233307|35|ABCD|00001111|01/03/2016|||n|n|AB/123456| 233307|36|ABCD|00002222|01/03/2016|||n|n|AB/123456| 233307|37|DCBAL|00003333|01/03/2016|||n|n||
I can search for the pipe at the start of a new line with ^\s*| but can’t figure out what syntax to use for the replace to move it up to the end of the previous line. Any help would be greatly appreciated. Thanks
-
@darren-brown
You need to modify your regex to include the preceding line break:\R\s*\|$
. If you replace this with|
you will get your desired result. Note that I also escaped the|
since it has special meaning in regexes. This is a quick-and-dirty shot, there are more elaborate approaches. -
@gerdb42 said in Move character to end of previous line:
\R\s*|$
Brilliant, I’ve just tested and it works perfectly. Thanks for the quick response.