众好汉,洒家含泪求一帮助。关于正则替换。整整浪费洒家一个上午洒家试了数次仍正则表达式所致,但洒家调试数次,均未成功,故而向众好汉求助。目的:去了此代码中的广告即:之间之内容。<br />源码如下:<br /><dl class='code'>PHP code<div class="code" style="position:relative; padding:0px; margin:0px;"><pre> <!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->[code=PHP] <table width="970" border="0" cellspacing="1" cellpadding="0" align="center"><br /> <tr> <br /> <td> <br /> <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#F0F0F0"><br /> <tr> <br /> <td width="60%" valign="top"> <br /> <table width="100%" border="0" cellspacing="1" cellpadding="5" bgcolor="#D7D7D7"><br /> <tr> <br /> <td bgcolor="#FFFFFF" colspan="2"><div class="l">网站基本信息 <div class="r">该页数据更新于 <span id="domainarr">18小时前<br /> <br /> <tr> <br /> <td bgcolor="#FFFFFF" width="25%" class="title">网站域名:<br /> <td bgcolor="#FFFFFF" width="75%" class="domain"><a href="/baidu.com" class="l">www.baidu.com<span id="weblink"><br /> <br /> <tr> <br /> <td bgcolor="#FFFFFF" width="25%" class="title">网站价值:<br /> <td bgcolor="#FFFFFF" width="75%"><span id="worth">2,013,862,787 <br /> 元 (不含域名价值,品牌价值及其行业附加值)<br /> <br /> <tr> <br /> <td bgcolor="#FFFFFF" colspan="2" class="title" align="center"><br /> <br /><br /><script type="text/javascript"><!--<br />google_ad_client = "ca-pub-3483611175549740";<br />/* 468x15, 创建于 10-4-6 */<br />google_ad_slot = "2068076510";<br />google_ad_width = 468;<br />google_ad_height = 15;<br />//--><br />src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> [/code]所用函数:echo preg_replace('/script"(.*)script/','',$arr1[0]);------解决方案-------------------- PHP code echo preg_replace("//s", "", $arr1[0]); ------解决方案--------------------PHP code 网站基本信息 该页数据更新于 18小时前 网站域名: www.baidu.com 网站价值: 2,013,862,787 元 (不含域名价值,品牌价值及其行业附加值) <!-- google_ad_client = "ca-pub-3483611175549740"; /* 468x15, 创建于 10-4-6 */ google_ad_slot = "2068076510"; google_ad_width = 468; google_ad_height = 15; //--> html; $Html=preg_replace('/.*<\/script>/ism','',$Html); echo $Html; <div class="clear"> Copy after login