簡體   English   中英

編譯失敗:字符類在偏移量4處的范圍無效

[英]Compilation failed: invalid range in character class at offset 4

我使用CI_Minifier並在更新PHP后遇到問題。

現在,當我使用preg_match函數時,我收到一個錯誤。

if (!preg_match("/^[\w-:]+$/", $tag)) { #error line
    $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
    if ($this->char === '<') {
        $this->link_nodes($node, false);

        return true;
    }

    if ($this->char==='>') {
        $node->_[HDOM_INFO_TEXT] .= '>';
    }
    $this->link_nodes($node, false);
    $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next

    return true;
}

錯誤是:

編譯失敗:字符類在偏移量4處的范圍無效

轉義連字符:

if (!preg_match("/^[\w\-:]+$/", $tag)) { 

或將其放在角色類的開頭:

if (!preg_match("/^[-\w:]+$/", $tag)) { 

或最后:

if (!preg_match("/^[\w:-]+$/", $tag)) { 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM