tags:

views:

243

answers:

1

How can I allow dashes in this pattern?

$str = preg_replace ( "/[^a-z \d]/i", "", $str ) ;
+4  A: 

Put it first.

$str = preg_replace ( "/[^-a-z \d]/i", "", $str ) ;
jpalecek