Skip to main content
Nintex Community Menu Bar
Solved

RegEx to add a space after a comma


DavidAD
Forum|alt.badge.img+8

There is a similar question about this topic (here), but I added a question at the end of it that's never been answered - possibly because the original question has already been marked as solved.

I use @burked's solution for getting rid of the brackets and quotation marks from items in a collection, and that works fine. But it seems that NWC no longer puts a space after the comma that separates the items. So I get output like this:

Choice 1,Choice 2,Choice 3,Choice 4

 

Of course, what I want is this:

Choice 1, Choice 2, Choice 3, Choice 4

 

I know next to zilch about RegEx, so I can't figure this out. Is there an expression to add a space after each comma so that the output isn't so ugly?

Best answer by SimonMuntz

Hi ​@DavidAD,

Does looping through the collection and building the string solve the problem?
Here is an example workflow.
Key: P77PH2swUv8NNeaNd17fKi2Bt9KGumD9PwcXi25zUTFx2DQQr

View original
Translate
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img+8
  • Nintex Employee
  • 85 replies
  • July 26, 2022

@DavidAD, you can add a second regex action that replaces the commas (,) with a comma and a space (, ). This can be added before or after the original setup, as the one referenced in the link is just removing the brackets and quotes. I did a quick test taking the output from the first action with output of Choice 1,Choice 2,Choice 3 running the replace on , and this seemed to get the desired output. 



Output:



 


 

Translate

DavidAD
Forum|alt.badge.img+8
  • Author
  • Scholar
  • 70 replies
  • July 26, 2022

By Jove, @burked, you've done it again! That does indeed work. Thanks very much! That's simpler than I expected.

Translate

DavidAD
Forum|alt.badge.img+8
  • Author
  • Scholar
  • 70 replies
  • February 5, 2025

@burked: Unfortunately, this no longer works. If you add a space after the comma in the Replacement text field, Nintex Workflow removes it automatically. I was actually using a semicolon in that field, but I tried a comma too and the result was the same. Now we’re back to this after removing the brackets and quotation marks:

Option 1,Option 2,Option 3

Nintex Workflow used to add a space automatically after the default comma in a collection. That stopped working, so the above solution was useful. Now that solution is no longer working. Is there another solution for adding a space between items in a collection? I’m needing it for a new workflow I’m developing now.

Translate

SimonMuntz
Nintex Employee
Forum|alt.badge.img+22
  • Nintex Employee
  • 2437 replies
  • Answer
  • February 5, 2025

Hi ​@DavidAD,

Does looping through the collection and building the string solve the problem?
Here is an example workflow.
Key: P77PH2swUv8NNeaNd17fKi2Bt9KGumD9PwcXi25zUTFx2DQQr

Translate

DavidAD
Forum|alt.badge.img+8
  • Author
  • Scholar
  • 70 replies
  • February 6, 2025

Hi, ​@SimonMuntz - thanks for the prompt reply. And yes - I do believe that would work! Thank you. I never would have thought of extracting the characters like that.

I developed a different workaround for my current use case that actually works better (adding each item from the collection to a table on a generated document), but I will certainly use this in the future.

Thanks again!

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings