JSFiddle - React, Tailwind, and code Playground

CSS

1233

JavaScript

text='1,87-99,88:12,sds-554,sdsd,787,99-145';
tex2=text.replace(/(\d)-(\d)/g,'$1:$2');
console.log(tex2);