# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"class=\"kick_t_dt\".+?(.+?)<\/span> <span class=\"kick_t_ko\".+?(.+?)<\/span>.+?(.+?)href=\'.+?(.+?)\/\'.+?(.+?)<\/a><\/td><td.+?(.+?)\/\'.+?(.+?)<\/a>"
test_str = ("</table>\n"
"<div class=\"ncet\"><li class=\"gradient6 ncet_round c25px\">Eastern - Round 1</li></div><div class=\"compgrp\"><div id=\"sc2209577-1\" class=\"scorecard\" title=\"\"></div><table class=\"blocks gteam team53089-1 team40896-1\" onmouseover=\"rowOver('53089-1','40896-1')\" onmouseout=\"resetOver()\">\n"
" <tbody><tr class=\"even\"><td class=\"kick_t\"><span class=\"kick_t_dt\">11.05.19</span> <span class=\"kick_t_ko\">20:00</span></td><td class=\"status\"></td><td class=\"home uc \"> <a href='/soccer/usa/teams/fc-cincinnati-NTMwODk=/'>FC Cincinnati</a></td><td class=\"score\"> - </td><td class=\"away uc \"><a href='/soccer/canada/teams/montreal-impact-NDA4OTY=/'>Montreal Impact</a> </td>\n"
" <td class=\"halftime\">-</td>\n"
" <td class=\"fav\"></td><td class='fav'></td><td class=\"fav\"><span id=\"m2209577-1\" class=\"spriteCCCCCC c42px ui-icon-plus-game matchbox\" title=\"\"></span></td></tr></tbody></table></div><div class=\"splitter\"></div><div class=\"ncet\"><li class=\"gradient6 ncet_round c25px\">Western - Round 1</li></div><div class=\"compgrp\"><div id=\"sc2209578-1\" class=\"scorecard\" title=\"\"></div><table class=\"blocks gteam team10751-1 team9956-1\" onmouseover=\"rowOver('10751-1','9956-1')\" onmouseout=\"resetOver()\">\n"
" <tbody><tr class=\"odd\"><td class=\"kick_t\"><span class=\"kick_t_dt\">11.05.19</span> <span class=\"kick_t_ko\">21:00</span></td><td class=\"status\"></td><td class=\"home uc \"> <a href='/soccer/usa/teams/fc-dallas-MTA3NTE=/'>FC Dallas</a></td><td class=\"score\"> - </td><td class=\"away uc \"><a href='/soccer/usa/teams/new-york-red-bulls-OTk1Ng==/'>New York Red Bulls</a> </td>\n"
" <td class=\"halftime\">-</td>\n"
" <td class=\"fav\"></td><td class='fav'></td><td class=\"fav\"><span id=\"m2209578-1\" class=\"spriteCCCCCC c42px ui-icon-plus-game matchbox\" title=\"\"></span></td></tr></tbody></table></div><div class=\"splitter\"></div><div class=\"ncet\"><li class=\"gradient6 ncet_round c25px\">Eastern - Round 1</li></div><div class=\"compgrp\"><div id=\"sc2209579-1\" class=\"scorecard\" title=\"\"></div><table class=\"blocks gteam team29401-1 team36415-1\" onmouseover=\"rowOver('29401-1','36415-1')\" onmouseout=\"resetOver()\">\n"
" <tbody><tr class=\"even\"><td class=\"kick_t\"><span class=\"kick_t_dt\">11.05.19</span> <span class=\"kick_t_ko\">22:00</span></td><td class=\"status\"></td><td class=\"home uc \"> <a href='/soccer/usa/teams/toronto-fc-Mjk0MDE=/'>Toronto FC</a></td><td class=\"score\"> - </td><td class=\"away uc \"><a href='/soccer/usa/teams/philadelphia-union-MzY0MTU=/'>Philadelphia Union</a> </td>\n"
" <td class=\"halftime\">-</td>\n"
" <td class=\"fav\"></td><td class='fav'></td><td class=\"fav\"><span id=\"m2209579-1\" class=\"spriteCCCCCC c42px ui-icon-plus-game matchbox\" title=\"\"></span></td></tr></tbody></table></div><div class=\"splitter\"></div><div class=\"ncet\"><li class=\"gradient6 ncet_round c25px\">Western - Round 1</li></div><div class=\"compgrp\"><div id=\"sc2209580-1\" class=\"scorecard\" title=\"\"></div><table class=\"blocks gteam team9955-1 team49517-1\" onmouseover=\"rowOver('9955-1','49517-1')\" onmouseout=\"resetOver()\">\n"
" <tbody><tr class=\"odd\"><td class=\"kick_t\"><span class=\"kick_t_dt\">11.05.19</span> <span class=\"kick_t_ko\">23:00</span></td><td class=\"status\"></td><td class=\"home uc \"> <a href='/soccer/usa/teams/los-angeles-galaxy-OTk1NQ==/'>Los Angeles Galaxy</a></td><td class=\"score\"> - </td><td class=\"away uc \"><a href='/soccer/usa/teams/new-york-city-fc-NDk1MTc=/'>New York City FC</a> </td>")
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