Home > Backend Development > PHP Tutorial > Regular expression example to get all superlinks on a certain web page_PHP tutorial

Regular expression example to get all superlinks on a certain web page_PHP tutorial

WBOY
Release: 2016-07-13 17:26:16
Original
850 people have browsed it



Regular expression

Return list


if(isset( $url)){
echo "$url has the following link:
";
$fcontents = file($url);
while(list(,$line)=each($fcontents )){
while(eregi((href[[:space:]]*=[[:space:]]*"?[[:alnum:]:@/._-]+"?)(. *),$line,$regs)){
$regs[1] = eregi_replace((href[[:space:]]*=[[:space:]]*"?)([[:alnum: ]:@/._-]+)("?),"2",$regs[1]);
echo " $regs[1]
";
$line = $regs[ 2];
}
}
}
?>



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531998.htmlTechArticleRegular expression returns list if(isset($url)){ echo "$url has the following links: " ; $fcontents = file($url); while(list(,$line)=each($fcontents)){ while(eregi((href[[:space:]]*=[[:space...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template