Page 1 of 1
How to eliminate white space?
Posted: Sun Dec 07, 2003 3:13 am
by tommt
Using the "VIEW>VISIBLE SPACES" options, I opened some of my files and noticed some white spaces that are not needed, like in this screenshot:
How can I eliminate those unneeded white spaces? I want to eliminate the white spaces BUT keeping the indenting, is it possible?
thanks
Posted: Sun Dec 07, 2003 3:31 am
by CyberSlug
A
regular expression search and replace can remove whitespace from the end of each line. Click Search, Replace then fill in the "Find what' field with
[[:blank:]]+$ and leave the other field blank. Make sure the "use regular expressions" box is checked.
How the regular expression works:
[[:blank:]] matches a tab or a space
+ matches one or more occurances of the previous item
$ constrains the searches to the end of the line
Hope that helps
Addendum: You can download a "Reformatting" macro that does this
http://www.textpad.com/add-ons/macros.html
Posted: Sun Dec 07, 2003 3:41 am
by tommt
Thanks for the addendum, seems what I need! Gonna try it now,
although, by your explanation, [[:blank:]]+ would remove the tabs as well, no? I'd like to remove spaces only while keeping the tabs.
thanks!
Posted: Sun Dec 07, 2003 4:41 am
by CyberSlug
In that case, try [ ]+$
See "How to Use Regular Expressions" in TextPad's help file for more info.