fork download
  1. import re
  2. txt = 'Την 02/12/2013 καταχωρήθηκε στο Γενικό Εμπορικό Μητρώο της Υπηρεσίας Γ.Ε.ΜΗ. του Επιμελητηρίου Βοιωτίας, με κωδικόαριθμό καταχώρισης Κ.Α.Κ.: 110035'
  3. p = re.compile(r'''Την\s? # matches Την with a possible space afterwards
  4. (?P<KEK_date>\d{2}/\d{2}/\d{4}) #matches a date of the given format and captures it with a named group
  5. .+ # Allow for an arbitrary sequence of characters
  6. (?:κωδικ.\s?αριθμ.\s?καταχ.ριση.|κ\.\.κ\.:?)\s+ # defines two lookaheads, either of which suffices
  7. (?P<KEK_number>\d+) # captures a sequence of numbers''', re.I | re.X)
  8. print(p.findall(txt))
Success #stdin #stdout 0.02s 9644KB
stdin
Standard input is empty
stdout
[('02/12/2013', '110035')]