As I came here and did not find a good generic solution, here is how I did it:
"1,2, 3,4,5".replace(/,([^\s])/g, ", $1");
This replaces comma followed by anything but a space, line feed, tab... by a comma followed by a space.
So the regular expression is:
,([^\s])
and replaced by
, $1