简体   繁体   English

preg_match_all 编译失败:字符类在偏移量处的范围乱序

[英]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.

相关问题 Symfony 验证错误:preg_match():编译失败:字符 class 在偏移处的范围乱序 - Symfony Validation error: preg_match(): Compilation failed: range out of order in character class at offset preg_match():编译失败:偏移处的字符类范围无效 - preg_match(): Compilation failed: invalid range in character class at offset 编译失败:字符类在偏移量12处范围混乱 - Compilation failed: range out of order in character class at offset 12 Preg_Match_All:编译失败 - Preg_Match_All : Compilation failed 警告:preg_split()[function.preg-split]:编译失败:字符类中的范围乱序 - Warning: preg_split() [function.preg-split]: Compilation failed: range out of order in character class preg_match_all():编译失败:在偏移203处无法重复 - preg_match_all(): Compilation failed: nothing to repeat at offset 203 runescape preg_match_all的问题:编译失败,没有匹配的括号 - Issue with preg_match_all : Compilation failed unmatched parentheses 编译失败:字符类在偏移量4处的范围无效 - Compilation failed: invalid range in character class at offset 4 Unicode 正则表达式:编译失败:字符类中的范围乱序 - Unicode Regular Expression: Compilation failed: range out of order in character class PHP:未定义偏移量:3-preg_match_all - PHP: Undefined offset: 3 - preg_match_all
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM