I'm trying to capitalize every letter after space and dash. Obviously, capitalizing every letter after a space isn't a problem:
$string = preg_replace('/[^a-zA-Z-\s]/s', '', $string);
$string = ucwords(strtolower($string));
does the trick.
However, I can't find a way to capitalize every letter after a dash, although this regex seems to match every letter after a dash (if i trust the answer).
Any help is appreciated!
I also tried:
$string = preg_replace('#\b[a-z0-9-_]+#i', strtoupper("$0"), $string);
without success...