Advertisement
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.Text.RegularExpressions;
- namespace Exercise
- {
- class Exercise
- {
- static void Main()
- {
- string text = "Dinko Delchev Trendafilov from Dimitrovgrad eng 7901048468. Ivan Ivanov Kolev from Haskovo egn 7806178023" +
- "Dimiter Nikolov Kostov from Qmbol egn 9010108703";
- string pattern = @"(?<names>[A-Z][a-z]+ [A-Z][a-z]+ [A-Z][a-z]+) (?<towns>[A-Z][a-z]+) (?<eng>\d{10})";
- var result = Regex.Matches(text, pattern);
- foreach (Match item in result)
- {
- Console.WriteLine(item.Groups["names"].Value);
- Console.WriteLine(item.Groups["towns"].Value);
- Console.WriteLine(item.Groups["egn"].Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement