php regex
test.html<!DOCTYPE html><html> <head>test</head> <body> <a id="a5" href="111">wawa</a> <a id="a6" href="222">hehe</a> <a id="a7" href="333">haha</a> <a id="a8" href="444">uuuu</a> ...... <b> <a id="a1" href="111">wawa</a> <a id="a2" href="222">hehe</a> <a id="a3" href="333">haha</a> <a id="a4" href="444">uuuu</a> </b> ........ </body></html>
$html = <<<TTT<!DOCTYPE html><html> <head>test</head> <body> <a id="a5" href="111">wawa</a> <a id="a6" href="222">hehe</a> <a id="a7" href="333">haha</a> <a id="a8" href="444">uuuu</a> ...... <b> <a id="a1" href="111">wawa</a> <a id="a2" href="222">hehe</a> <a id="a3" href="333">haha</a> <a id="a4" href="444">uuuu</a> </b> ........ </body></html>TTT;preg_match_all('@<b>([^`]*?)<\/b>@i',$html,$match);preg_match_all('@href="(.+?)"@i',$match[0][0],$matches);var_dump($matches);
$html = <<<TTT<!DOCTYPE html><html> <head>test</head> <body> <a id="a5" href="111">wawa</a> <a id="a6" href="222">hehe</a> <a id="a7" href="333">haha</a> <a id="a8" href="444">uuuu</a> ...... <b> <a id="a1" href="111">wawa</a> <a id="a2" href="222">hehe</a> <a id="a3" href="333">haha</a> <a id="a4" href="444">uuuu</a> </b> ........ </body></html>TTT;preg_match_all('@<b>([^`]*?)<\/b>@i',$html,$match);preg_match_all('@href="(.+?)"@i',$match[0][0],$matches);var_dump($matches);
ただし、正規表現に加えて、simplehtmldom などの DOM 解析も使用できます
~s*(]+href="(.*?)">.*?)*?s*~msi
それはそれです、自分で調整してください