# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"\b([a-zA-Z]*)(ne|eb|ar|(?<!nom)br|il|ay|yo|un|nio|ul|lio|go|sto|ep|mbr|ct|ubr|ov|ic|en|ero|fe(?!cha)|ma|ab|ju|jo|ja|jn|ag|se|oc|nov|dic)([a-zA-Z]*)[- \/.,\n|i]{1,3}(0[1-9]|[12][0-9]|3[01]|[1-9]|i|o[1-9zi]|i[1-9zo])[- \/.,\n|i]{1,3}[2z][0o]\d{0,2}\b"
test_str = ("Feb zi /\n"
"zozo\n"
"10\n"
"12030\n"
"nombre\n"
"fecha\n"
"01 / 2020\n"
"yl-20-2.020\n"
"FECHA: 2020-06-04 08:57:29\n"
"FECHA: 12 106 120\n"
"GARAG\n"
"marzo\n"
"15/2000\n"
"mayo 15/20\n"
"jul 1/20\n"
"Junio 17/20\n"
"S:\n"
"BUN\n"
"Centro Médico\n"
"FECHA:\n"
"05 06 - 2020\n"
"Warta carolina onerrez\n"
"Nombre:\n"
"1/6/200\n"
"ONDY Soklo\n"
"Fecha:\n"
"nFECHA: 2020-06-04 08:57:29\n"
"FECHA: 2020-06-04 08:57:2\n"
"Bogotá, 08/jun./2020\n"
"FECHA 11/06/2020\n"
"nBOGOTAOC - 10/06/2020\n"
"1/6/200\n"
"ONDY Soklo\n"
"Fecha:\n"
"echa 24-unio 12020\n"
"Fecha:\n"
"17.06.2020\n"
"FECHA:\n"
"2020\n"
"24 Junio\n"
"Fecha: 12 - vw\n"
"FECHA\n"
"VUNIO 18\n"
"18/2010\n"
"Jula 2020\n"
"FECHA:\n"
"05 06 - 2020\n"
"10 /m/ 200\n"
"2020\n\n"
"FECHA\\nTo\\nol06\n"
"\\n18106 12020\\n\n"
"204\\nFecha:\n")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.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