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?
Use String.replace with a regexp.
> var input = '1,2,3,4,5', output = input.replace(/(\d+,)/g, '$1 '); > output "1, 2, 3, 4, 5"