I have a string that is made up of a list of numbers, seperated by commas. How would I add a space after each comma using Regex?
Another simple generic solution for comma followed by n spaces:
"1,2, 3, 4,5".replace(/,[s]*/g, ", "); > "1, 2, 3, 4, 5"
Always replace comma and n spaces by comma and one space.