using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace H2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strings = new string[]
            {
                "Meier, Hans;Heinrichstr. 123 45332 Essen;23.02.2001",
                "Müller-Lüdenscheidt, Otto;Berliner Str. 89 45123 Essen;12.04.1987",
                "Schmitdt, Hans O.;Sommer Allee 1 17643 Lubmin;01.03.1917"
            };
            foreach (string s in strings)
            {
                Console.WriteLine(s);
                Console.WriteLine("Strasse: " + AdressParser.SearchStreet(s));
                Console.WriteLine("Nachname: " + AdressParser.SearchLastName(s)); 
                Console.WriteLine("Geburtsdatum: " + AdressParser.SearchBirthDate(s));
                Console.WriteLine();
            }
            Console.ReadLine();
        }
    }

    class AdressParser
    {
        static public string SearchStreet(string text)
        {
            string pattern = @"[a-zA-ZäöüÄÖÜß\-\s]+\.?\s\d+[a-zA-Z]?";
            Match match = Regex.Match(text, pattern);
            return match.ToString();
        }

        static public string SearchLastName(string text)
        {
            string pattern = @"^[\w\-]+";
            Match match = Regex.Match(text, pattern);
            return match.ToString();
        }

        static public string SearchBirthDate(string text)
        {
            string pattern = @"(\d{2}\.\d{2}\.\d{2,4})";
            Match match = Regex.Match(text, pattern);
            return match.ToString();
        }

        static public MatchCollection SearchPattern(string text, string pattern)
        {
            return Regex.Matches(text, pattern);
        }
    }
}
