# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"class=\"(.*?)\""
test_str = (" Xem thêm</a></div></div></div></div><div class=\"em en eo ep eq\"><a href=\"/groups/720798081668729bacr=1591362312%3A1008883346193533%3A1008883346193533%2C0%2C0%3A7%3AKw%3D%3D&multi_permalinks&refid=18\"><span>Xem thêm bài viết</span></a></div></div><a name=\"groupMenuBottom\"></a><div class=\"er\"><h3 class=\"es\">Menu nhóm</h3><ul class=\"bz et\"><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=about&refid=18\">Giới thiệu</a></td><td class=\"n\"></td></tr></tbody></table></li><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=info&refid=18\">Thông tin</a></td><td class=\"n\"></td></tr></tbody></table></li><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=members&refid=18\" id=\"u_0_3\">Thành viên</a></td><td class=\"n\"><span class=\"eu cu\" id=\"u_0_2\">239</span></td></tr></tbody></table></li><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=photos&refid=18\" id=\"u_0_7\">Ảnh</a></td><td class=\"n\"><span class=\"eu cu\" id=\"u_0_6\">1928</span></td></tr></tbody></table></li><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=events&refid=18\">Sự kiện</a></td><td class=\"n\"></td></tr></tbody></table></li><li class=\"du\"><table class=\"m bl\"><tbody><tr><td class=\"t\"><a href=\"/groups/720798081668729?view=files&refid=18\">File</a></td><td class=\"n\"></td></tr></tbody></table></li></ul></div><div class=\"ev\" style=\"display:none\"><div class=\"ew\"><div class=\"ex\"><img src=\"https://static.xx.fbcdn.net/rsrc.php/v3/yR/r/CjVACNCmi_H.png\" width=\"54\" height=\"24\" class=\"ey ez s\" /><div class=\"fa\"><div class=\"fb\"><a href=\"#\" class=\"bt fc bv\">Xem dòng thời gian</a><a href=\"#\" class=\"bt fc bv\">Thêm vào nhóm</a><a href=\"#\" class=\"bt fc bv\">Mời tham gia sự kiện</a></div></div></div></div></div></div><div style=\"display:none\"></div></div></div><div class=\"bz\"><div class=\"fd\"><div class=\"fe\"><table class=\"m\"><tbody><tr><td class=\"t ff\" style=\"width:50%\"><b class=\"fg\">Tiếng Việt</b><a class=\"fh\" href=\"/a/language.php?\n")
matches = re.finditer(regex, test_str)
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