How can I allow dashes in this pattern?
$str = preg_replace ( "/[^a-z \d]/i", "", $str ) ;
How can I allow dashes in this pattern?
$str = preg_replace ( "/[^a-z \d]/i", "", $str ) ;
Put it first.
$str = preg_replace ( "/[^-a-z \d]/i", "", $str ) ;