我现在应该能够阅读一个正则表达式,但是所有人都可以通过这个来说话吗?
/([^"^\s]+)\s*|"([^"]+)"\s*/g
Run Code Online (Sandbox Code Playgroud)
只是为了背景; 它在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
Run Code Online (Sandbox Code Playgroud)
正如Blindy所说,它要么匹配一个没有'^',引号或空格的字符串,要么它匹配两个引号字符之间的所有内容.并且它保存了它在后向引用中发现的内容(我称之为'组',因为我的Python卡在我脑海中).
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           375 次  |  
        
|   最近记录:  |