0
我的題目是preg_match_all模式搜索
some html codes<h3 class="r"><a href="/url?q=http://www.somedomain.com/args/">Some Title</a></h3>some html codes
我現在的模式是:
"/<h3 class="r"><a href="\/url?\?q\=http(...)/"
結果是:
<h3 class="r"><a href="/url?q=http://
我希望得到確切的網址,http://www.somedomain.com/args/ 或只是<h3 class="r"><a href="/url?q=http://www.somedomain.com/args/">Some Title</a></h3>
,所以我可以解析它返回的網址。
但我無法做到。
任何幫助,將不勝感激。謝謝!
[你如何解析和處理PHP中的HTML/XML?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in -php) –
用'preg_match_all()':'\ b(https?:// [^ \ s()<>] + \。[^ \ s()<>] +)\ b'試試這個正則表達式。 [見**演示**](https://eval.in/136152) –