I want to remove all special characters from string and add only one "-"(hyphen) in the place.
Consider below example
var string = 'Lorem%^$&*&^Ipsum#^is@!^&simply!dummy text.'
So, from the above string, if there is a continuous number of special characters then I want to remove all of them and add only one "-" or if there is a single or double special character then also that should be replaced by "-"
Result should be like this
Lorem-Ipsum-is-simply-dummy text-
I have tried below, but no luck
var newString = sourceString.replace(/[\. ,:-]+/g, "-");
-kept or removed?