for matchNum, match inenumerate(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 inrange(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.
Match 1 was found at 33-72: /* blabla
Compiler_Warning blablalba
*/
Match 2 was found at 140-179: /* blabla
Compiler_Warning blablalba
*/
Match 3 was found at 180-219: /* blabla
Compiler_Warning blablalba
*/
Match 4 was found at 252-291: /* blabla
Compiler_Warning blablalba
*/