[英]preg_match_all Compilation failed: range out of order in character class at offset
I have trouble to find specific object with preg_match_all pattern.我很难找到具有 preg_match_all 模式的特定对象。 I have a text.
我有一个文本。 But I would like to find just one specific
但我只想找到一个特定的
Like I have a string of text就像我有一串文本
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 */
However I just need to find "website":[" https://bitcoin.org/ "].但是我只需要找到“网站”:[“ https://bitcoin.org/ ”]。 Where website is dynamic data.
其中网站是动态数据。 Such as website can be a google "website":[" https://google.com/ "]
比如网站可以是google“网站”:[“ https://google.com/ ”]
Right now I have something like this.现在我有这样的事情。 That's just return a bulk of urls.
那只是返回大量网址。 I need just specific
我只需要具体的
$parsePage = "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 */";
$pattern = '/
\"website":[" # [ character
(?: # non-capturing group
[^{}] # anything that is not a { or }
| # OR
(?R) # recurses the entire pattern
)* # previous group zero or more times
\"] # ] character
/x';
preg_match_all($pattern, $parsePage, $matches);
print_r($matches[0]);
尝试 :
$pattern = '~"website":\["([^"]*)"~'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.