$str = "The quick brown fox jumped over the lazy dog."; $str = preg_replace('/\s/','-',$str); echo $str;更详细的请看原著摘抄自http://www.5idev.com/p-php_preg_replace.shtml