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

Question

Question

Regular Expression to remove 2 or more spaces in a token

asked on January 9, 2018

I'm building a token that could have double spaces.  How can I use Regular Expressions to find and replace the double space or another way doing this in workflow.

 

Thank you!

0 0

Answer

SELECTED ANSWER
replied on January 10, 2018

This assumes your source token is two words separated by one or more spaces.  Create two more tokens called beginning and end.  Set their values from the source token using the regular expressions below.

Beginning has the regular expression: ^(\w+)\s+  This captures word characters from the start of the source token, but only when followed by one or more spaces.

End has the regular expression: \s+(\w+)$  This captures word characters from the end of the source token, but only when preceded by one or more spaces.

Use those two tokens to rebuild your original token, adding only a single space between them.

1 0

Replies

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

Sign in to reply to this post.