2010-08-02 57 views
-1

可能重複找到這個:
What is the best regular expression for validating email addresses?如何使用正則表達式

我怎樣才能找到正則表達式的郵件?

 
"[email protected]" 
"[email protected]" 
"[email protected]" 
"[email protected]" 
"[email protected]" 

此外,我怎麼能找到這個項目:

 
track0; (any track number); 
track50 (any track number); 
Track 0 (any track number); 
Track 10 (any track number); 
Track10 (any track number); 
+1

發現嘗試搜索互聯網:正則表達式的lib – 2010-08-02 09:56:59

+4

SO滿的正則表達式問題。爲什麼不在發佈另一個之前搜索SO? – Oded 2010-08-02 09:57:52

+0

爲什麼不學習正則表達式?一旦你知道正則表達式是如何工作的,你所要求的是相當容易的。 http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/1565922573 – 2010-08-02 10:03:24

回答

0

1)直接從微軟:How to match a pattern by using regular expressions and Visual C#

using System.Text.RegularExpressions; 
Regex emailregex = new Regex("(?<user>[^@]+)@(?<host>.+)"); 
Match m = emailregex.Match(s); 

2)你想驗證與該格式的所有條目或做你只想得到那個「(任何曲目號碼)」的價值?