Advertisement
svetlyoek

Untitled

Mar 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleApp214
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string text = Console.ReadLine();
  12. string pattern = @"\+359([ -])2(\1)\d{3}(\1)\d{4}\b";
  13. MatchCollection matches = Regex.Matches(text, pattern);
  14. List<string> phones = new List<string>();
  15. foreach (Match match in matches)
  16. {
  17. phones.Add(match.ToString());
  18. }
  19. Console.Write(string.Join(", ", phones));
  20. Console.Write("\n");
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement