Php 模式的simplehtmldom URL提取和匹配
我有以下代码从给定的web url中提取所有超链接(url)Php 模式的simplehtmldom URL提取和匹配,php,simple-html-dom,Php,Simple Html Dom,我有以下代码从给定的web url中提取所有超链接(url) <?php include "simple_html_dom.php"; $html=new simple_html_dom(); $html->load_file('http://www.indiastudychannel.com/colleges'); $links=$html->find('a'); foreach($links as $l) { $path='http://www.indiast
<?php include "simple_html_dom.php";
$html=new simple_html_dom();
$html->load_file('http://www.indiastudychannel.com/colleges');
$links=$html->find('a');
foreach($links as $l)
{
$path='http://www.indiastudychannel.com/colleges'.$l->href;
//doScrape($path);
echo $path."<br>";
}
?>
上面的代码提取所有超链接,但我只想提取具有以下模式的链接
http://www.indiastudychannel.com/colleges/54489-Rvs-College-Arts-And-Science.aspx
我知道这可以用正则表达式来实现,但我不知道具体是如何实现的。请举例说明,以便我能容易理解 试试看
preg_match("/^http://www.indiastudychannel.com/colleges/54489/\");
看看
及