替换所有空格为空
$contents=" abc "; $contents=preg_replace('/s+/','',$contents); //结果$contents="abc";
替换所有换行符
$contents = str_replace(array(" ", " ", " "), "", $contents);
匹配任意字符除了换行(.*?)
preg_match_all('/<h1 class="ff f20 fb fl">(.*?)</h1>/',$contents, $out, PREG_SET_ORDER);