Splitting Long lines at fixed intervals

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
canyonhawks
Posts: 2
Joined: Thu Apr 09, 2009 10:48 am

Splitting Long lines at fixed intervals

Post by canyonhawks »

I have a long line that I need to split into 4 lines at fixed column intervals.
For instance I need to insert a new line at column 79, 158, and 237.

I tried using a macro to do this and it works sometimes. If there are spaces at the point of inserting the new line textpad truncates the spaces and throws everything off.


ANy ideas?

Any way to specify columns to insert new lines using regex?

Thanks
Verlyin
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

Replace
^(.{79})(.{79})(.{79})(.)
by
\1\n\2\n\3\n\4

(using Posix for Regex)
canyonhawks
Posts: 2
Joined: Thu Apr 09, 2009 10:48 am

Splitting Long lines at fixed intervals

Post by canyonhawks »

Works perfect. Thanks for the rapid response. I'll file that one away.
Post Reply