sivancheva

DBukarova

Nov 3rd, 2017
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. namespace RegexFullName
  2. {
  3. class Program
  4. {
  5. static void Main()
  6. {
  7. Regex pattern = new Regex(@"^[A-Z][a-z]+\s{1}[A-Z][a-z]+$");
  8.  
  9. string name = Console.ReadLine();
  10.  
  11. MatchCollection matches = pattern.Matches(name);
  12.  
  13. foreach (Match m in matches)
  14. {
  15. Console.Write(m.Groups[0].Value + " ");
  16. }
  17. Console.WriteLine();
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment