Ask Your Question
0

How to remove trailing spaces in calc

asked 2019-08-13 18:37:10 +0200

Dougm1966 gravatar image

I can't find an answer anywhere that works.

I have several columns with lots of trailing spaces...some of them have several spaces at the end...up to 10-15 spaces.

I've tried this ^\s+|\ s+$ and it found a couple of cells with 1 leading space but doesn't find the trailing spaces. Can anyone help out on this? It's driving me mad. Thanks

edit retag flag offensive close merge delete

Comments

^\s+|\ s+$ has some strange space between \ and s ;-)

Mike Kaganski gravatar imageMike Kaganski ( 2019-08-13 19:31:38 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-13 19:24:56 +0200

Opaque gravatar image

updated 2019-08-13 19:28:12 +0200

Hello

to remove trailling spaces, I use [ ]*$ (Just to be sure: there is a space character within the brackets and option Regular expressions ticked in Find & Replace)

edit flag offensive delete link more

Comments

I'd rather use +$ (note the expression starts with a space character which isn't that visible..) so a replacement is only done when there actually is at least one trailing space. Using * matches also if there is none and the content is unnecessarily replaced with itself. Also, the character class with a single character just complicates the expression internally, a single blank character is sufficient in this case.

erAck gravatar imageerAck ( 2019-08-14 13:46:51 +0200 )edit

+$ doesnt find anything in a test (LO 6.3.0.4). May be you meant \s+$ or [ ]+$

Opaque gravatar imageOpaque ( 2019-08-14 14:00:51 +0200 )edit

It works, as said the expression starts with a space so it is " +$" not "+$". The Highlighting munges that.

erAck gravatar imageerAck ( 2019-08-14 14:19:30 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-08-13 18:37:10 +0200

Seen: 17 times

Last updated: Aug 13