Advertisement
martinvalchev

Match_Full_Name

Feb 21st, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Match_Full_Name
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.  
  15.             string regex = @"\b[A-Z][a-z]+ [A-Z][a-z]+\b";
  16.  
  17.             string names = Console.ReadLine();
  18.  
  19.             MatchCollection match = Regex.Matches(names, regex);
  20.  
  21.             foreach (Match name in match)
  22.             {
  23.                 Console.Write(name.Value + " "); ;
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement