就是下面这个。
(.+)<(\s*)meta(.+)charset(\s*)=(\s*)UTF-8

解决方案 »

  1.   


    <html><head><meta http-equiv="content-type" content="text/html; charset=GB2312"><title>Google</title><script>var _gjwl=location;function _gjuc(){var a=_gjwl.hash;if(a.indexOf("&q=")>0||a.indexOf("#q=")>=0){a=a.substring(1);if(a.indexOf("#")==-1){for(var c=0;c<a.length;){var d=c;if(a.charAt(d)=="&")++d;var b=a.indexOf("&",d);if(b==-1)b=a.length;var e=a.substring(d,b);if(e.indexOf("fp=")==0){a=a.substring(0,c)+a.substring(b,a.length);b=c}else if(e=="cad=h")return 0;c=b}_gjwl.href="search?"+a+"&cad=h";return 1}}return 0};
    window._gjuc && location.hash && _gjuc();</script><style>body,td,a,p,.h{font-family:arial,sans-serif}.h{color:#36c;font-size:20px}.q{color:#00c}.ts td{padding:0}.ts{border-collapse:collapse}#gbar{height:22px;padding-left:2px}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}#gbi,#gbs{background:#fff;left:0;position:absolute;top:24px;visibility:hidden;z-index:1000}#gbi{border:1px solid;border-color:#c9d7f1 #36c #36c #a2bae7;z-index:1001}#guser{padding-bottom:7px !important}#gbar,#guser{font-size:13px;padding-top:1px !important}@media all{.gb1,.gb3{height:22px;margin-right:.73em;vertical-align:top}#gbar{float:left}}.gb2{display:block;padding:.2em .5em}a.gb1,a.gb2,a.gb3{color:#00c !important}.gb2,.gb3{text-decoration:none}a.gb2:hover{background:#36c;color:#fff !important}</style><script>window.google={kEI:"o2OGSYP0F4yGkAWZxKmyAw",kEXPI:"17259,19463",kHL:"zh-CN"};
    google.y={};google.x=function(e,g){google.y[e.id]=[e,g];return false};window.gbar={};(function(){var b=window.gbar,f,h;b.qs=function(a){var c=window.encodeURIComponent&&(document.forms[0].q||"").value;if(c)a.href=a.href.replace(/([?&])q=[^&]*|$/,function(i,g){return(g||"&")+"q="+encodeURIComponent(c)})};function j(a,c){a.visibility=h?"hidden":"visible";a.left=c+"px"}b.tg=function(a){a=a||window.event;var c=0,i,g=window.navExtra,d=document.getElementById("gbi"),e=a.target||a.srcElement;a.cancelBubble=true;if(!f){f=document.createElement(Array.every||window.createPopup?"iframe":"div");f.frameBorder="0";f.src="#";d.parentNode.appendChild(f).id="gbs";if(g)for(i in g)d.insertBefore(g[i],d.firstChild).className="gb2";document.onclick=b.close}if(e.className!="gb3")e=e.parentNode;do c+=e.offsetLeft;while(e=e.offsetParent);j(d.style,c);f.style.width=d.offsetWidth+"px";f.style.height=d.offsetHeight+"px";j(f.style,c);h=!h};b.close=function(a){h&&b.tg(a)}})();</script></head><body bgcolor=#ffffff text=#000000 link=#0000cc vlink=#551a8b alink=#ff0000 onload="document.f.q.focus();if(document.images)new Image().src='/images/nav_logo3.png'" topmargin=3 marginheight=3><div id=gbar><nobr><b class=gb1>网页</b> <a href="http://images.google.cn/imghp?hl=zh-CN&tab=wi" onclick=gbar.qs(this) class=gb1>图片</a> <a href="http://ditu.google.cn/maps?hl=zh-CN&tab=wl" onclick=gbar.qs(this) class=gb1>地图</a> <a href="http://news.google.cn/nwshp?hl=zh-CN&tab=wn" onclick=gbar.qs(this) class=gb1>资讯</a> <a href="http://video.google.cn/?hl=zh-CN&tab=wv" onclick=gbar.qs(this) class=gb1>视频</a> <a href="http://blogsearch.google.cn/?hl=zh-CN&tab=wb" onclick=gbar.qs(this) class=gb1>博客</a> <a href="http://www.google.cn/intl/zh-CN/options/" onclick="this.blur();gbar.tg(event);return !1" class=gb3><u style=height:22px;vertical-align:top>更多</u> <small>&#9660;</small></a><div id=gbi> <a href="http://shenghuo.google.cn/shenghuo/?hl=zh-CN&tab=w8" onclick=gbar.qs(this) class=gb2>生活</a> <a href="http://www.google.cn/rebang/home?hl=zh-CN&tab=w9" onclick=gbar.qs(this) class=gb2>热榜</a> <a href="http://daohang.google.cn/?hl=zh-CN&tab=wA" onclick=gbar.qs(this) class=gb2>网站导航</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.com/calendar/render?hl=zh-CN&tab=wc" class=gb2>日历</a> <a href="http://picasaweb.google.com/home?hl=zh-CN&tab=wq" onclick=gbar.qs(this) class=gb2>照片</a> <a href="http://docs.google.com/?hl=zh-CN&tab=wo" class=gb2>文档</a> <a href="http://sites.google.com/?hl=zh-CN&tab=w3" class=gb2>协作平台</a> <div class=gb2><div class=gbd></div></div> <a href="http://tools.google.com/pinyin/?hl=zh-CN&tab/a=wI" onclick=gbar.qs(this) class=gb2>输入法</a> <a href="http://toolbar.google.com/?hl=zh-CN&tab=wO" onclick=gbar.qs(this) class=gb2>工具栏</a> <a href="http://pack.google.cn/?hl=zh-CN&tab=wP" onclick=gbar.qs(this) class=gb2>软件精选</a> <div class=gb2><div class=gbd></div></div> <a href="http://www.google.cn/intl/zh-CN/options/" class=gb2>更多 &raquo;</a></div> </nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div><div align=right id=guser style="font-size:84%;padding:0 0 4px" width=100%><nobr><a href="/url?sa=p&pref=ig&pval=3&q=http://www.google.cn/ig/china%3Fhl%3Dzh-CN%26source%3Diglk&usg=AFQjCNGNYfgta9G_BNut0SFGzavY4Y2pjQ">个性化首页</a> | <a href="https://www.google.com/accounts/Login?continue=http://www.google.cn/&hl=zh-CN">登录</a></nobr></div><center><br clear=all id=lgpd><img src=/intl/zh-CN/images/logo_cn.gif width=286 height=110 border=0 alt="Google" title="Google"><br><br><form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%>&nbsp;</td><td align=center nowrap><input name=hl type=hidden value=zh-CN><input type=hidden name=ie value="GB2312"><input autocomplete="off" maxlength=2048 name=q size=55 title="Google 搜索" value=""><br><input name=btnG type=submit value="Google 搜索"><input name=btnI type=submit value="&nbsp;手气不错&nbsp;"></td><td nowrap width=25%><font size=-1>&nbsp;&nbsp;<a href=/advanced_search?hl=zh-CN>高级搜索</a><br>&nbsp;&nbsp;<a href=/preferences?hl=zh-CN>使用偏好</a><br>&nbsp;&nbsp;<a href=/language_tools?hl=zh-CN>语言工具</a></font></td></tr><tr><td align=center colspan=3><font size=-1><span style="text-align:left"><input id=all type=radio name=meta value="" checked><label for=all>所有网页 &nbsp;</label><input id=ch type=radio name=meta value="lr=lang_zh-CN|lang_zh-TW"><label for=ch>中文网页 &nbsp;</label><input id=lgr type=radio name=meta value="lr=lang_zh-CN"><label for=lgr>简体中文网页 &nbsp;</label><input id=cty type=radio name=meta value="cr=countryCN"><label for=cty>中国的网页 &nbsp;</label></span></font></td></tr></table></form><br><br><font size=-1><a href="/intl/zh-CN/ads/">广告计划</a> - <a href="/intl/zh-CN/about.html">Google 大全</a> - <a href=http://www.google.com/ncr>Google.com in English</a></font><p><font size=-1>&copy;2009 - <a href="/intl/zh-CN/privacy.html">隐私权</a> - <font size=-2><a href=http://www.miibeian.gov.cn/ target=_blank>ICP&#35777;&#21512;&#23383;B2-20070004&#21495;</a>&nbsp;&nbsp;<img src=/intl/zh-CN_cn/images/cn_icp.gif align=absmiddle width=15 height=16 alt="icp"></font></font></p></center></body><script>if(google.y)google.y.first=[];window.setTimeout(function(){var xjs=document.createElement('script');xjs.src='/extern_js/f/CgV6aC1DThICY24gDiswCjgVQAIsKzAOOAQsKzAYOAMs/gk3Dwjd3L14.js';document.getElementsByTagName('head')[0].appendChild(xjs)},0);google.y.first.push(function(){google.ac.i(document.f,document.f.q,'','')})</script><script>function _gjp() {!(location.hash && _gjuc()) && setTimeout(_gjp, 500);}window._gjuc && _gjp();</script></html>
    1
    >
    0ation.hash && _gjuc()) && setTimeout(_gjp, 500);}window._gj
      

  2.   

    Regex: <(\s*)meta([^>].*?)charset(\s*)=(\s*)UTF-8([^>].*?)>    
    如此可以匹配得到
    <html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title><script>var _gjwl=location;function _gjuc(){var