Page 1 of 1

Deleting spaces at end of rows

Posted: Sun Aug 17, 2008 6:03 pm
by gcotterl
How can I delete all spaces between the last non-space character and the carriage-return character?

Posted: Sun Aug 17, 2008 7:38 pm
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.

Posted: Mon Aug 18, 2008 5:57 pm
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