JSFiddle - React, Tailwind, and code Playground by Kristian Jabilles July 16, 2020 JavaScript let regex = /^[\w-]+$/; console.log( 'test-test'.replace(regex, ' ') )