I want to remove empty commas from the string using JQuery.
Please see the attached images to see what i mean.


This will remove all unnecessary commas in the text and update the text value:
$('.dyn-').text($('.dyn-').text().replace(/^,*|,(?=,)|,$/g, ''));
The regex is in three parts, seperated by |: