JSFiddle - React, Tailwind, and code Playground
JavaScript
x="1, 2, 3.5, 4,5,6,7 ,8"
y=x.match(/ *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) */);
alert(y)
x="1, 2, 3.5, 4,5,6,7 ,8"
y=x.match(/ *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) *,? *([0-9.]*) */);
alert(y)