You are viewing limited content. For full access, please sign in.

Question

Question

Regular Expression - Remove Extra Spaces

asked on August 8, 2018

Trying to remove extra spaces using pattern matching. Wondering if anyone could help me out!

Example: 

"Hi        buddy        what's up    bro" 

to

"Hi buddy what's up bro"

Thanks in advance!

1 0

Replies

replied on August 8, 2018 Show version history

Not sure about a regular expression, but the Token Editor functions are what I typically use. If you Split on one blank space, remove all empty items, then rejoin them on a blank space it should do what you want.

The formatted token would look like %(TokenName#@Split( );RemoveEmptyItems@##[ ]#)

0 0
replied on August 8, 2018

Thank you! But it looks like there are also line breaks "/n" in the string as well. 

0 0
replied on August 8, 2018

Do you mean line breaks in the source?

0 0
replied on August 8, 2018

yes

0 0
replied on August 8, 2018

A  RESOLUTION  AUTHORIZING  THE  AWARDING  OF  A  CONTRACT
                      FOR      ENGINEERING      SERVICES      FOR      GROUND      WATER
                      MONITORING  TO  KILLAM  ASSOCIATES,   27  BLEEKER  STREET,
              P.O.   BOX   1008,   MILLBURN,   NEW  JERSEY   07041-1008   IN
                      THE  AMOUNT  OF  $14 , 000. 00

replied on August 8, 2018 Show version history

Try adding a "Trim" function in between the Split and the Remove Empty Items

0 0
replied on August 8, 2018

worked... thanks Jason!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.