import re

def showMatches(pattern, text):
    '''Prints out helpful information about all matches of a regular
expression in a given text.
 INPUTS:
  - pattern (string): a regular expression.
  - text (string): a target text in which to search for matches.
 OUTPUTS: None.
 SIDE-EFFECTS: Prints out information about all the matches.'''
    print('Text: ' + text)
    print('Patt: ' + pattern)
    match_iterator = re.finditer(pattern, text)
    for match in match_iterator:
        print('------- New Match -------')
        print('  match.start() = ' + str(match.start()))
        print('  match.end()   = ' + str(match.end()))
        print('  Whole match: ' + match.group(0))
        if match.lastindex is not None:
            print('  Match groups:')
            for i in range(1, match.lastindex+1):
                print('    match.group(' + str(i) + '): '
                      + match.group(i))

