I have this to replace spaces with dashes which works just fine
$stripped_string = str_replace(' ', '-', $string_to_be_stripped);
Now I want to remove all non-alphanumerical characters except the dashes. I have this, but it also removes the dashes:
$stripped_string = ereg_replace('[^A-Za-z0-9]', '', $string_to_be_stripped);
I also tried [^A-Za-z0-9_-]’ but it doesn’t work. I’m not that good with regular expressions.
Any help on removing all non-alphanumerical characters except dashes?