Possible Duplicate:
c# regex email validation
I am currently using the following regex and code to parse Email addresses from html documents
string pattern = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
Regex regex = new Regex(
pattern,
RegexOptions.None | RegexOptions.Compiled);
MatchCollection matches = regex.Matches(input); // Here is where it takes time
MessageBox.Show(matches.Count.ToString());
foreach (Match match in matches)
{
...
}
For example:
Try parsing http://www.amelia.se/Pages/Amelia-search-result-page/?q=
Over at RegexHero and it crashes.
Is there any way to optimise this?