Replace every 4th line break

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Replace every 4th line break

Post by steve1040 »

I have a file with over 1000 lines

Like this
CM.ID=1448 OR
CM.ID=1740 OR
CM.ID=1741 OR
CM.ID=1742 OR
CM.ID=1744 OR
CM.ID=2621 OR
CM.ID=2622 OR
CM.ID=2623 OR

etc

I would like the file to look like this
CM.ID=1448 OR CM.ID=1740 OR CM.ID=1741 OR CM.ID=1742 OR
CM.ID=1744 OR CM.ID=2621 OR CM.ID=2622 OR CM.ID=2623 OR
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

I think you mean you want to replace every line break except every fourth one with a space.
Find what: (.*)\n(.*)\n(.*)\n(.*)\n
Replace with: $1 $2 $3 $4\n

[X] Regular expression

Replace All
steve1040
Posts: 39
Joined: Fri Oct 13, 2006 2:19 am

Post by steve1040 »

ben_josephs wrote:I think you mean you want to replace every line break except every fourth one with a space.
Find what: (.*)\n(.*)\n(.*)\n(.*)\n
Replace with: $1 $2 $3 $4\n

[X] Regular expression

Replace All
Ben I get an error
States Cannot match Regular Expression

Any idea what I might be doing wrong?
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Has a spurious space been introduced at the end of the regex?
Post Reply