<p class="t_msgfont">比如域名是alixixi.com,正则表达式如下:</p> <p class="t_msgfont"> </p> <p class="t_msgfont">$S = 'http://www.alixixi.com/'<br>$domain = array('com','cn','name','org','net');<br>$SS = $S;<br>$dd = implode('|',$domain);<br>$SS = preg_replace('/(.*)((\w+)(\.('.$dd.'))*\.('.$dd.'))$/iU','$2',$SS);<br>echo $SS ;</p> <p style="width:100%;text-align:center;margin:10px 0"> <br> <br> </p> <p style="width:100%;text-align:center;margin:10px 0"> </p> <p class="clear"></p>