我使用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 *是第二个要点。 –