2012-07-24 41 views
0

我正在使用http://gskinner.com/RegExr/文本正則表達式模式。正則表達式組 - 選擇文本Preceeding電子郵件地址

我試圖用這個正則表達式來獲取電子郵件地址的各個部分及其前面的文本。

(.{1,20})([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4}) 

如果鼠標移到藍色顯示的文本,然後你會看到有是1與組2個問題..

請使用文本作爲一個例子。

Zak - [email protected] (use first). Cell 

ssadsada, [email protected], and cc: [email protected] Include a 
specific time for the following: 

回答

0

這是你想要什麼:Regex Example

(([\w]*[\s-\.]?[\S\s]){1,2})\s([\w-\.]+)@((?:[\w]+\.)+)([a-zA-Z]{2,4}) 

Group1: Zak - 
Group2: asdasdsad 
Group3: gmail. 
Group4: com 
+0

謝謝,修改了一點在我的處境工作。 – 2012-07-24 06:39:06

+0

我很高興能幫助你 – 2012-07-24 06:40:52

相關問題