You are here: PSPad forum > English discussion forum > Re: How to replace \n with a character instead of join lines?

Re: How to replace \n with a character instead of join lines?

#1 How to replace \n with a character instead of join lines?

Posted by: slampken | Date: 2012-11-06 18:18 | IP: IP Logged

Hello,

I'm 2 months new to PSPad and searched the forums but did not find a direct answer for my question. I have figured out a work around but would like to know if there is a better, more direct method.

It is easy to replace characters in a line with \n to create new lines.

Example:

Porky Pig; Daffy Duck; Bugs Bunny; Elmer Fudd;

I use CTRL-H > Find "; " > Replace with "\n" to get this:

Porky Pig
Daffy Duck
Bugs Bunny
Elmer Fudd

(Interestingly the Info box says Searched expression "; " was replaced 10x)

However, if I want to go backwards I cannot find "\n" and simply replace with "; ".

Info box says Next occurrence of "\n" not found.

I've tried search / replace $ and hex codes without success but I discovered a 2-step work around.

Step 1: CTRL-H > Find "$" > Replace with ";" to get this:

Porky Pig;
Daffy Duck;
Bugs Bunny;
Elmer Fudd;

Setp 2: Select all lines > Edit > Line Manipulation > Join Lines to get this:

Porky Pig; Daffy Duck; Bugs Bunny; Elmer Fudd;

I understand from forum messages I've seen that there are line manipulation limitations but I have a feeling there is there an easier way and I just need some direction from the experts.

Thanks in advance!

Options: Reply | Quote | Up ^


#2 Re: How to replace \n with a character instead of join lines?

Posted by: vbr | Date: 2012-11-06 23:14 | IP: IP Logged

Hi,
there are indeed limitations of multiline search and replace in PSPad; you have found a usual workaround using the available program functionality.
Another possibility is to use some script addon for such tasks (which again may have own specificities...):
forum.pspad.com

hth,
vbr

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR