You are here: PSPad forum > English discussion forum > regex question

regex question

#1 regex question

Posted by: ppetree | Date: 03/22/2018 16:30 | IP: IP Logged

I have a file that is one very long line. Each section of the line starts with 0: like this:

0: text 0: more text 0: still more text 0: error 0: console.log 0: more text

I want to replace the 0: with a newline \n

I've turned on regex, tried searching for 0:, \0:, \0\:, ^\0\: and most every other thing I can think of. I manage to get it to replace the very first 0: on the line and nothing else. The box stays up with Yes, skip, no, Yes to All etc and I can keep clicking Yes but all that happens is the cursor moves to the right on the newly created blank line. Once I hit "Yes to All" just to see what would happen and I had to pop up the task manager and kill pspad.

Any suggestions?

Options: Reply | Quote | Up ^

#2 Re: regex question

Posted by: vbr | Date: 03/22/2018 20:33 | IP: IP Logged

...I want to replace the 0: with a newline \n

with reagrds to newlines handling, there are some limitations in PSPad, for both searching and replacing.

In this case a workaround can help, you can just use the mentioned pattern, but before that, the cursor must be placed at the and of the file and the search direction in the dialog would be "backwards".


Options: Reply | Quote | Up ^

#3 Re: regex question

Posted by: Andreas | Date: 03/23/2018 12:52 | IP: IP Logged

Yes, you need to do a backwards replace but cursor must not be at the end, can also be at the beginning.

Or you can use the addon phreplace. This is more comfortable, faster, more stable and with a higher performance.

Options: Reply | Quote | Up ^

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