How can I write regular expression to remove double dash -- into single dash - and if string start or end with dash replace with empty string.
var oldString = "abc--xyz--"
var filtered = oldStringt.replace(???????);
Sample Input >>>> Output
abc--xyz-- >>>>> abc-xyz
abc---xyz-123 >>>>> abc-xyz-123
--abc-xyz-123 >>>>> abc-xyz-123