Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Text.RegularExpressions;
- namespace Study
- {
- class Program
- {
- static void Main(string[] args)
- {
- string phonenomber = Console.ReadLine();
- String pattern = @"\+[359]+(-| )[2]\1[\d]{3}\1[\d]{4}\b";
- MatchCollection matches = Regex.Matches(phonenomber, pattern);
- List<string> result = new List<string>();
- foreach (var item in matches)
- {
- result.Add(item.ToString());
- }
- Console.WriteLine(String.Join(", ", result));
- }
- }
- }
Add Comment
Please, Sign In to add comment