| View previous topic :: View next topic |
| Author |
Message |
yuki OOo Advocate


Joined: 20 Oct 2005 Posts: 264
|
Posted: Sun Apr 16, 2006 7:47 am Post subject: Removing spaces |
|
|
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 |
|
 |
thom314 OOo Enthusiast


Joined: 03 Aug 2005 Posts: 186 Location: Denver, Colorado
|
Posted: Sun Apr 16, 2006 8:24 am Post subject: |
|
|
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 |
|
 |
yuki OOo Advocate


Joined: 20 Oct 2005 Posts: 264
|
Posted: Sun Apr 16, 2006 8:28 am Post subject: |
|
|
Thanks a lot!
You saved me a lot of time! |
|
| Back to top |
|
 |
|