我一直在谷歌搜索和通過堆棧溢出提供的推薦問題。但是,我沒有找到答案。正則表達式只捕獲第一場比賽
我想用正則表達式來分析字符串,例如字符串的是
Lot: He said: Thou shalt not pass!
我想捕捉Lot
爲一組,和He said: Thou shalt not pass!
。然而,當我用我的(.+): (.+)
模式,則返回
Lot: He said:
和Thou shalt not pass!
是否有可能使用正則表達式來捕獲He said: Thou shalt not pass
?
你想捕捉的第二部分沒有'!'? – 2014-09-01 09:44:28