//提取中文字符 @header ( 'Content-Type: text/html; charset=utf-8' ); $str = <<<EOT 网站名字:PHP中文网 网站域名:http://www.php.cn/ 网站基本情况: 网站快照隔天 网站pr=0 百度权重=2 网站反向链接5853 收录量=53 每天专人维护 定时更新 height="38" border="0" alt="到百度首页"></a> <p class="tab"> <a href="http://news.baidu.com/ns?cl=2&rn=20&tn=news&word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7" onmousedown="return c({'fm':'tab','tab':'news'})">新闻</a> <b>网页</b> <a href="http://tieba.baidu.com/f?kw=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7&fr=wwwt" onmousedown="return c({'fm':'tab','tab':'tieba'})">贴吧</a> <a href="http://zhidao.baidu.com/q?ct=17&pn=0&tn=ikaslist&rn=10&word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7&fr=wwwt" onmousedown="return c({'fm':'tab','tab':'zhidao'})">知道</a> <a href="http://mp3.baidu.com/m?tn=baidump3&ct=134217728&lm=-1&word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7" onmousedown="return c({'fm':'tab','tab':'mp3'})">MP3</a> <a href="http://image.baidu.com/i?tn=baiduimage&ct=201326592&lm=-1&cl=2&word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7" onmousedown="return c({'fm':'tab','tab':'pic'})">图片</a> <a href="http://video.baidu.com/v?ct=301989888&rn=20&pn=0&db=0&s=25&word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7" onmousedown="return c({'fm':'tab','tab':'video'})">视频</a> <a href="http://map.baidu.com/m?word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7&fr=ps01000" onmousedown="return c({'fm':'tab','tab':'map'})">地图</a> <span id="tb_mr" onmousedown="return c({'fm':'tab','tab':'tbmore'});"><b>更多</b><small>▼</small></span></p><p id="more"><a href="http://baike.baidu.com/searchword/?word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7&pic=1" onmousedown="return c({'fm':'tab','tab':'baike'})">百科</a><a href="http://wenku.baidu.com/search?word=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7&lm=0&od=0" onmousedown="return c({'fm':'tab','tab':'wenku'})">文库</a><a href="http://dict.baidu.com/s?wd=unicode%D7%D6%B7%FB%D6%B5%20%B7%B6%CE%A7" onmousedown="return c({'fm':'tab','tab':'dict'})">词典</a><p></p><a href="http://www.baidu.com/more/" onmousedown="return c({'fm':'tab','tab':'more'})">更多<span>>></span></a></p></p><form name="f" action="s" class="fm"><input type="hidden" name="tn" value="baiduhome_pg"><input type="hidden" name="bs" value="unicode字符值 范围"><input type="hidden" name="f" value="8"><input type="hidden" name="rsv_bp" value="1"><input name="wd" id="kw" class="i" value="unicode字符值 范围" maxlength="100"><span class="btn_wr"><input type="submit" id="su" value="百度一下" class="btn" onmousedown="this.className='btn btn_h'" onmouseout="this.className='btn'"></span><span class="tools"><span id="mHolder"><p id="mCon"><span>输入法</span></p><ul id="mMenu"><li><a href="#" name="ime_hw">手写</a></li><li><a href="#" name="ime_py">拼音</a></li><li class="ln"></li><li><a href="#" name="ime_cl">关闭</a></li></ul></span><span class="seth" id="seth"><strong>推荐 : </strong><a href="#" onClick="h(this)" onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':1})">把百度设为主页</a></span> <span class="setf" id="setf"><strong>推荐 : </strong><a href="javascript:void(0)" onClick="fa(this)" onmousedown="return ns_c({'fm':'behs','tab':'favorites','pos':1})">把百度加入收藏夹</a></span> </span></form></p><br> <p id="container"> <table width="30%" cellpadding="0" cellspacing="0" align="right"><tr> <td align="left" style="padding-right:10px"> <p style="border-left:1px solid #e1e1e1;padding-left:10px;word-break:break-all;word-wrap:break-word;"> EOT; $str = strip_tags($str,""); $str = str_replace(array(' ',"\t","\r\n","\r","\n"),'',$str); preg_match_all('/[\w\s\x{4e00}-\x{9fff}]+/u', $str, $matches); $str = implode('', $matches[0]); print_r($str);