2012-10-12 91 views

回答

3

這裏有一個解釋你的正則表達式是如何工作的

Match the regular expression below and capture its match into backreference number 1 «(\w+)» 
    Match a single character that is a 「word character」 (letters, digits, and underscores) «\w+» 
     Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» 
Match the characters 「, 」 literally «, » 
Match the regular expression below and capture its match into backreference number 2 «(\w+)» 
    Match a single character that is a 「word character」 (letters, digits, and underscores) «\w+» 
     Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+» 

灰色,詹姆斯
(\ w +),(\ w +)

Name不遵循逗號。

+0

謝謝,你從哪裏得到了解釋。它看起來像是由程序生成的。 – BrainLikeADullPencil

0

匹配旁邊一個字一個逗號沒有空格「(\ w +),」

匹配一個逗號和空格後一個字「(\ w +)」

相關問題