# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?<=\<h3\>).+(?=\<\/h3\>)"
test_str = ("<h3>COVEMA</h3>\n"
"<h3>PALMERO</h3>\n"
"<h3>PLASTIFERRO</h3>\n"
"<h3>UOCRA</h3>\n"
"<h3>REPAS</h3>\n"
"<h3>BTU</h3>\n"
"<h3>PANEDILE</h3>\n"
"<h3>ELEPRINT</h3>\n"
"<h3>JOSÉ J. CHEDIACK</h3>\n"
"<h3>NIRO CONSTRUCCIONES</h3>\n"
"<h3>HELPORT</h3>\n"
"<h3>BISCAYNE</h3>\n"
"<h3>COARCO</h3>\n"
"<h3>ESUCO</h3>\n"
"<h3>CPC</h3>\n"
"<h3>TEL 3</h3>\n"
"<h3>CARTELLONE</h3>\n"
"<h3>MACRO</h3>\n"
"<h3>VIAL AGRO</h3>\n"
"<h3>ISOLUX CORSÁN</h3>\n"
"<h3>AFCP</h3>\n"
"<h3>FINNING</h3>\n"
"<h3>ROGGIO</h3>\n"
"<h3>ROVELLA CARRANZA</h3>\n"
"<h3>ACINDAR</h3>\n"
"<h3>IERIC</h3>\n"
"<h3>IGARRETA MÁQUINAS</h3>\n"
"<h3>RIVA</h3>\n"
"<h3>GRUPO ESTISOL</h3>\n"
"<h3>IECSA</h3>\n"
"<h3>ARMAFERRO</h3>\n"
"<h3>BRICONS</h3>\n"
"<h3>CNH INDUSTRIAL</h3>\n"
"<h3>PAOLINI</h3>\n"
"<h3>SERVIUR</h3>\n"
"<h3>SANDVIK</h3>\n"
"<h3>DECAVIAL</h3>\n"
"<h3>ODEBRECHT</h3>\n"
"<h3>ENAS</h3>\n"
"<h3>SITRA</h3>\n"
"<h3>SUPERCEMENTO</h3>\n"
"<h3>JCR</h3>\n"
"<h3>CONSTRUMEX</h3>\n"
"<h3>BRIALES</h3>\n"
"<h3>CAPUTO</h3>\n"
"<h3>LUCIANO</h3>\n"
"<h3>GALICIA</h3>\n"
"<h3>VICTOR CONTRERAS</h3>\n"
"<h3>SIKA ARGENTINA</h3>\n"
"<h3>CRIBA</h3>\n"
"<h3>BOETTO Y BUTTIGLIENGO</h3>\n"
"<h3>MILICIC</h3>\n"
"<h3>PERIODICO EL CONSTRUCTOR</h3>\n"
"<h3>PHONERENTAL</h3>\n"
"<h3>DOS ARROYOS</h3>\n"
"<h3>MARTINEZ Y DE LA FUENTE</h3>\n"
"<h3>AUSA</h3>\n"
"<h3>LUIS LOSI</h3>\n"
"<h3>AESA</h3>\n"
"<h3>CONSTRUCTORA SUDAMERICANA</h3>\n"
"<h3>PLANTEL</h3>\n"
"<h3>PCR</h3>\n"
"<h3>BANCO DE LA NACIÓN ARGENTINA</h3>\n"
"<h3>SUBTERRÁNEOS DE BUENOS AIRES</h3>\n"
"<h3>HOLA SIM</h3>\n"
"<h3>JOSÉ LUIS TRIVIÑO</h3>\n"
"<h3>TECHINT</h3>\n"
"<h3>EDUARDO COLOMBI</h3>\n"
"<h3>ALEMARSA</h3>\n"
"<h3>CENTRO CONSTRUCCIONES</h3>\n"
"<h3>TECNIPISOS</h3>\n"
"<h3>XAPOR</h3>\n"
"<h3>FONTANA NICASTRO</h3>\n"
"<h3>CONCRET-NOR</h3>\n"
"<h3>DYCASA</h3>\n"
"<h3>BURGWARDT</h3>\n"
"<h3>SULLAIR</h3>\n"
"<h3>FONDO FIDUCIARIO FEDERAL DE INFRAESTRUCTURA REGIONAL</h3>\n"
"<h3>FLOWTEX</h3>\n"
"<h3>PETERSEN THIELE Y CRUZ</h3>\n"
"<h3>LIHUÉ</h3>\n"
"<h3>IRAM</h3>\n"
"<h3>ESTUDIO YMAZ</h3>\n"
"<h3>VIDOGAR</h3>\n"
"<h3>BICE</h3>\n"
"<h3>ROMERO CAMMISA</h3>\n"
"<h3>BATIMAT</h3>\n"
"<h3>ALBA CAUCIÓN</h3>\n"
"<h3>PROBA</h3>\n"
"<h3>ICF</h3>\n"
"<h3>TECMA</h3>\n"
"<h3>ALESTE</h3>\n"
"<h3>DELEGACIÓN PROVINCIA DE BUENOS AIRES</h3>\n"
"<h3>HIDRAVIAL</h3>\n"
"<h3>BANCO CIUDAD</h3>\n"
"<h3>LAMANNA</h3>")
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