JSFiddle - React, Tailwind, and code Playground JavaScript var t = '100' px; var m = t.split(/\b/); alert(m[0]); alert(m[1]);