JSFiddle - React, Tailwind, and code Playground JavaScript var v = '2tim'; v = v.replace(/(\d)/g, '$1 '); alert(v);