I have fews combinations of strings that I need to bring in to one pattern, that is multiple spaces should be removed, double hyphens should be replaced with single hypen, and single space should be replaced with single hyphen.
I have already tried this expression.
$output = preg_replace( "/[^[:space:]a-z0-9]/e", "",
…