在包含以下内容的字符串中搜索URL

时间:2020-02-03 13:59:14

标签: php regex

我在变量中有html代码:

$html = '<html>
  <a href="http://example.com/extnu/111"></a>
  <a href="http://example.com/extnu/222"></a>
</html>';

如何搜索/extnu/并找到包含该词的第一个URL?所以结果应该是 http://example.com/extnu/111;

0 个答案:

没有答案