Solved

RegEx to add a space after a comma


Userlevel 2
Badge +7

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?

icon

Best answer by burked 26 July 2022, 18:24

View original

2 replies

Userlevel 5
Badge +8

@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:



 


 

Userlevel 2
Badge +7

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

Reply