tags:

views:

59

answers:

3

Possible Duplicate:
What is the best regular expression for validating email addresses?

Hi

How can I find emails with regex ?

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

Also how can I find this items :

track0; (any track number);
track50 (any track number);
Track 0 (any track number);
Track 10 (any track number);
Track10 (any track number);
A: 

1) Straight from Microsoft: 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) Do you want to validate all entries with that format or do you just want to get that "(any track number)" value?

Hal
A: 

First one, try searching or use Regular Expression Library

Second, try this:

Regex regex = new Regex(@"[^\d]+\d");
Martin Ingvar Kofoed Jensen
+1  A: 

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b

found on http://www.regular-expressions.info/email.html

robinsonc494