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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login