JSFiddle - React, Tailwind, and code Playground JavaScript var value = "123gfr/54ee2"; value = value.replace(/[^\/\d]/g,''); alert(value);