JSFiddle - React, Tailwind, and code Playground
by Moien Tajik
JavaScript
var bib = "#سلام@چطوری!خوبی؟چه&خبرا*چیکارا+میکنی=کجاها^میری><?~$%÷×";
// Remove Special Characters
bib = bib.replace(/[`~!@#$%^&*()_|+\-=?؟;:'"÷,.×<>\{\}\[\]\\\/]+/g, " ");
// Remove first & last space of string
bib = bib.replace(/^\s+|\s+$/g, "");
// Replace spaces with hyphen (-)
bib = bib.replace(/\s+/g, "-");
document.write(bib);