Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace FixEmails
- {
- class Program
- {
- static void Main(string[] args)
- {
- var command = Console.ReadLine();
- var email = "";
- while (command != "stop")
- {
- email = Console.ReadLine();
- var pattern = new Regex(@"[A-Za-z]+\@[A-Za-z]+\.[^(uk)(us)\s]+");
- var matches = pattern.Matches(email);
- foreach (Match username in matches)
- {
- Console.WriteLine($"{command} -> {username.Value.Trim()}");
- break;
- }
- command = Console.ReadLine();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement