Generic HTML standard hyperlink parameter get regular expression test
Because I'm going to do something like a professional search engine recently, I need to crawl all the hyperlinks in the web.
Everyone help test all of a sudden, the following code can be for all the standard hyperlinks.
The test code is as follows:
Copy CodeThe code is as follows:
// --------------------------------------------------------------------------
File name:Noname1.php
Description: Generic link parameter get regular expression test
REQUIREMENT:PHP4 (http://www.php.net)
Copyright (C), Honestqiao, 2005, All rights Reserved.
Author:honestqiao (honestqiao@hotmail.com)
Parameter description:
$strSource: HTML pages that contain standard links
$strResult: Results of processing
Additional Instructions:
Standard links, using the links contained in the situation
// --------------------------------------------------------------------------
$strSource = <<T1
T2
T3
T4
HTML;
Preg_match_all ('/(. +?) <\/a.*?>/sim ', $strSource, $strResult, Preg_pattern_order);
for ($i = 0; $i < count ($strResult [1]); $i + +)
{
printf ("%d href= (%s) title= (%s) \ n", $i, $strResult [1][$i], $strResult [2][$i]);
}
?>
If your test data conforms to the standard link, but is not processed here, please let me know the test data and your test environment.
Thank you.
http://www.bkjia.com/PHPjc/320346.html www.bkjia.com true http://www.bkjia.com/PHPjc/320346.html techarticle generic HTML standard hyperlink parameter get regular expression test because you're going to do something like a professional search engine recently, you need to crawl all the hyperlinks in the web. Let's help test it ...