JSFiddle - React, Tailwind, and code Playground JavaScript var num = "1215464565"; num = num.toString(); num.replace(/(.{2)/g,"-1"); alert(num);