【发布时间】:2020-03-25 15:12:33
【问题描述】:
我很难找到具有preg_match_all 模式的特定对象。我有一个文本。但我只想找到一个特定的
就像我有一串文本
sadasdasd:{"website":["https://bitcoin.org/"]tatic/cloud/img/coinmarketcap_grey_1.svg?_=60ffd80');display:inline-block;background-position:center;background-repeat:no-repeat;background-size:contain;width:239px;height:41px;} .cqVqre.cmc-logo--size-large{width:263px;height:45px;}
/* sc-component-id: sc-2wt0ni-0 */
但是我只需要找到"website":["https://bitcoin.org/"]。网站是动态数据。比如网站可以是google"website":["https://google.com/"]
现在我有这样的东西。那只是返回大量的网址。我只需要具体的
$pattern = '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#';
preg_match_all($pattern, $parsePage, $matches);
print_r($matches[0]);
我的模式真的很糟糕,一直坚持下去
【问题讨论】:
标签: php regex preg-match-all