Advertisement
svetlyoek

(C# Shell App Paste)

Mar 19th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  3. using System;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Collections.Generic;
  7. using System.Text.RegularExpressions;
  8. namespace CSharp_Shell
  9. {
  10.  
  11.     public static class Program
  12.     {
  13.         public static void Main()
  14.         {
  15.            string text = Console.ReadLine();
  16.             string pattern = @"\+359([ -])2(\1)\d{3}(\1)\d{4})\b";
  17.             MatchCollection matches = Regex.Matches(text, pattern);
  18.             List<string> phones = new List<string>();
  19.             foreach(Match match in matches)
  20.             {
  21.                 phones.Add(match.ToString());
  22.             }
  23.             Console.Write(string.Join(", ",phones));
  24.             Console.Write("\n");
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement