OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Removing spaces

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
yuki
OOo Advocate
OOo Advocate


Joined: 20 Oct 2005
Posts: 264

PostPosted: Sun Apr 16, 2006 7:47 am    Post subject: Removing spaces Reply with quote

I have cells with leading and trailing spaces that I want to get rid of. I guess a regex search could do this for me, but I failed to get any results.

What would the regex be for:

- replace any space with nothing?
- replace any leading space with nothing?

Thanks in advance!
Back to top
View user's profile Send private message
thom314
OOo Enthusiast
OOo Enthusiast


Joined: 03 Aug 2005
Posts: 186
Location: Denver, Colorado

PostPosted: Sun Apr 16, 2006 8:24 am    Post subject: Reply with quote

You can use two regular expressions: "^ *" and " *$" (leaving off the quotes of course and there is a "space" in front of each asterisk) and leave the Replace as window empty. The first expression trims off leading spaces and the second expression trims off trailing spaces.

You need to do the two expressions separately. If the regex replace capability was a little bit better (like in perl or sed) you would likely be able to find a way to combine them into one expression but I don't think that can be done in OO's Find and Replace window.
Back to top
View user's profile Send private message
yuki
OOo Advocate
OOo Advocate


Joined: 20 Oct 2005
Posts: 264

PostPosted: Sun Apr 16, 2006 8:28 am    Post subject: Reply with quote

Thanks a lot!

You saved me a lot of time!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group