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

Question

Question

Remove all space characters using regex in Connector

asked on October 22, 2019

Hi LF Community,

 

Is there anyway to remove space characters from all the captured token.

Exemple :   10 000.00  will be 10000.00

0 0

Answer

SELECTED ANSWER
replied on October 22, 2019 Show version history

You can use this:

(\S*)(?:\s*)(\S*)(?:\s*)(.*)

 

That will remove up to 2 spaces from the text. If there are additional spaces, they will not be removed.

10 000.00  =  10000.00

10 000 000.00  =  10000000.00

10 000 000 000.00  =  10000000 000.00

As you see above, if there are more than 2 spaces, it will remove the first 2, then leave the subsequent spaces. You can expand the number of spaces it will remove by adding an additional...

(\S*)(?:\s*)

...to the BEGINNING of the expression (the ending (.*) needs to remain the same).

 

Examples:

(\S*)(?:\s*)(\S*)(?:\s*)(.*)  -  Removes the first 0-2 spaces

(\S*)(?:\s*)(\S*)(?:\s*)(\S*)(?:\s*)(.*)  -  Removes the first 0-3 spaces

(\S*)(?:\s*)(\S*)(?:\s*)(\S*)(?:\s*)(\S*)(?:\s*)(.*)  -  Removes the first 0-4 spaces

...etc...

 

1 0

Replies

replied on October 23, 2019 Show version history

The Workflow Token Editor also has a Trim function that removes whitespace before and after a token value. While it doesn't doesn't address the specific case you mention here (with white space in the middle), I thought it was worth mentioning.

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

Sign in to reply to this post.