php正则替换所有空格和换行

替换所有空格为空

$contents="    abc           ";
$contents=preg_replace('/\s+/','',$contents);
//结果$contents="abc";

替换所有换行符

$contents = str_replace(array("\r\n", "\r", "\n"), "", $contents);

匹配任意字符除了换行(.*?)

preg_match_all('/<h1 class="ff f20 fb fl">(.*?)<\/h1>/',$contents, $out, PREG_SET_ORDER);
上一篇:"AppServer"--->UDP--->"LogWriteServer"


下一篇:计算机基础part1