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;
- class MathPhoneNumber
- {
- static void Main()
- {
- string phoneNumber = @"359-2-222-2222, +359/2/222/2222, +359-2 222 2222, +359 2-222-2222, +359-2-222-222, +359-2-222-22222,
- +359 2 222 2222, +359-2-222-2222";
- string pattern = @"^|[+359]+(-| )[2]\1[\d]{3}\1[\d]{4}\b";
- MatchCollection matches = Regex.Matches(phoneNumber, pattern);
- foreach (Match match in matches)
- {
- Console.WriteLine("{0} ", match);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment