# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"Aankomst:\sMAANDAG\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|dinsdag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|woensdag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|donderdag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|vrijdag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|zaterdag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:|zondag\s([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9])\s\s\s\sVertrek:"
test_str = (" +++++++++++++++++++++++++++++++++++++++++++++++\n"
" + Ref Document: 137165 +\n"
" +++++++++++++++++++++++++++++++++++++++++++++++\n"
"From: jamirequest@jetair.be\n"
"emaildestin;L ;137165;yourname\n\n"
"jetair@groupepvcp.com\n"
"CENTER PARCS ERPERHEIDE Uw code: 78154 / BLI\n"
" Datum: 18/11/15\n"
" ***** Reservering in allotment *****\n"
"Reserveringsnummer: 021146151 SJ Reserveringsdatum: 18/11/2015\n\n"
"Gelieve de volgende reservering te noteren aub aan contractprijs\n\n"
"Aankomst: zondag 01/02/2016 Vertrek: vrijdag 05/02/2016 4 Nachten.\n\n"
" 1 x type 30: EP082 app. 2 pers. comfort\n"
" Bad of douche, Terras, TV, Kitchenette\n"
" In allotment\n"
" Logies\n"
" MIDWEEKVERBLIJF\n"
" 01/02/16 - 05/02/16\n"
" EARLY BOOKING\n\n"
" Mr. D.DEBERGH 28 jaar\n"
" Mevr. S.BOUDEN 25 jaar\n\n\n"
"Het is niet nodig deze reservering te herbevestigen\n\n"
"Opmerkingen/speciale wensen\n"
" indien mogelijk babybed\n\n"
"cpref,021146151,...\n"
"Einde van het bericht")
matches = re.search(regex, test_str, re.IGNORECASE)
if matches:
print ("Match was found at {start}-{end}: {match}".format(start = matches.start(), end = matches.end(), match = matches.group()))
for groupNum in range(0, len(matches.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = matches.start(groupNum), end = matches.end(groupNum), group = matches.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html