Advertisement
YavorGrancharov

Match_Name(regex_lab)

Oct 28th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 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_Name
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             string input = Console.ReadLine();
  15.  
  16.             string pattern = @"\b[A-Z]{1}[a-z]+\s[A-Z]{1}[a-z]+\b";
  17.  
  18.             Regex regex = new Regex(pattern);
  19.  
  20.             Match output = regex.Match(input);
  21.  
  22.             while (output.Success)
  23.             {
  24.                 Console.Write(output.Value + " ");
  25.                 output = output.NextMatch();
  26.             }
  27.             Console.WriteLine();
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement