Deleting spaces at end of rows

General questions about using TextPad

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

Post Reply
gcotterl
Posts: 248
Joined: Wed Mar 10, 2004 8:43 pm
Location: Riverside California USA

Deleting spaces at end of rows

Post by gcotterl »

How can I delete all spaces between the last non-space character and the carriage-return character?
User avatar
SteveH
Posts: 327
Joined: Thu Apr 03, 2003 11:37 am
Location: Edinburgh, Scotland
Contact:

Post by SteveH »

You need to perform the following search and replace:

Find what:
<space>+$
Replace with:
Leave it blank
With regular expression enabled and POSIX regular expression syntax enabled in the general preferences.

Please note there is a space character before the + character. The expression means search for any space character repeated at least once and followed by and end of line ($).

Hope this helps.
Running TextPad 5.4 on Windows XP SP3 and on OS X 10.7 under VMWare or Crossover.
kitimat
Posts: 45
Joined: Tue Jul 20, 2004 5:44 pm

Post by kitimat »

There is also an option in CONFIGURE | PREFERENCES| DOCUMENT CLASSES which when enabled will STRIP TRAILING SPACES FROM LINES WHEN SAVING. If you need this feature a lot then this may be a better choice than constantly running the macro.
I have it enabled for my text document class.

kitimat
Post Reply