![](/img/trans.png)
[英]What does this RegExp pattern /(?:^|:|,)(?:\s*\[)+/g mean in Javascript?
[英]What does this regexp match on? /([^“^\s]+)\s*|”([^“]+)”\s*/g
现在我应该真的可以阅读正则表达式了,但是任何人都可以通过它与我交谈吗?
/([^"^\s]+)\s*|"([^"]+)"\s*/g
仅出于背景; 它在Alfresco中用于匹配文档标签。 是否有网站可以将其插入并获得解释(SO除外)!
( # start a capture group
[^"^\s]+ # one or more characters NOT quote, caret, or white space
) # close capture group
\s* # followed by optional white space
| # either match everything before this '|' or everything after it
" # match a quote character
( # start capture group
[^"]+ # one or more characters NOT quote
) # close capture group
" # the closing quote
\s* # followed by optional white space
因此,正如Blindy所说的,它要么匹配没有'^',引号或空格的字符串,要么匹配两个引号字符之间的所有内容。 并且它保存了在反向引用中找到的内容(之所以称为“组”,是因为我将Python卡在了头上)。
它要么与标识符(不包含"
,“ ^
"
或任何空格字符(空格,制表符,换行符)匹配,要么与引号之间匹配,后跟任意数量的空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.