我使用this庫這一行文字preg_match_all中的%符號會做什麼?
#asdfasdf #日本語 スペース @漢字 #日本語 あ http://url file:///url「おくむら」最高ー!…
的,它給了我正確的價值觀
#asdfasdf #日本語
但在代碼中有%
在regex
'%(\A#(\w|(\p{L}\p{M}?)|-)+\b)|((?<=\s)#(\w|(\p{L}\p{M}?)|-)+\b)|((?<=\[)#.+?(?=\]))%u'
這說明什麼百分號呢?
在iOS中,它沒有像這樣的百分號。
"(\\A#(\\w|(\\p{L}\\p{M}?)|-)+\\b)|((?<=\\s)#(\\w|(\\p{L}\\p{M}?)|-)+\\b)|((?<=\\[)#.+?(?=\\]))"
在PHP它給我的錯誤:preg_match_all(): Unknown modifier '|'
這是什麼百分號呢?
什麼,這是正則表達式從其他選項分隔符。它們在'preg_ *'庫中是必需的,參見http://php.net/manual/en/regexp.reference.delimiters.php – jeroen
* PHP:[pattern syntax](http://php.net/manual/ en/reference.pcre.pattern.syntax.php)*鏈接到相關文檔,* Delimiters *是第二個要點。 –