JSFiddle - React, Tailwind, and code Playground
RegExp string replace
by eggleton
HTML
<p id="before"></p>
<hr />
<p id="after"></p>
JavaScript
var string = "Example String with letters and 123 !@# _ - _ = -$ pp - d!"
var pattern = /[^a-zA-Z0-9-]/g; // http://www.regexr.com
// new RegExp("[^a-zA-Z0-9-]","g")
$(function(){
$("#before").text(string);
var after = string.replace(pattern, "").toLowerCase();
$("#after").text(after);
});