ellapt

T14.18.ExtractEmailAddresses

Feb 3rd, 2013
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. class ExtractEmailAddresses
  5. {
  6. static void Main()
  7. {
  8. Console.WriteLine("Extract all email addresses from given text\n");
  9.  
  10. string text = "Extract all email addresses from [email protected]. System.Globalization,[email protected] hello";
  11.  
  12. foreach (var detail in Regex.Matches(text, @"\w+@\w+\.\w+"))
  13. {
  14. Console.WriteLine(detail);
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment