import re


def num_matches(pattern, string):
    """Find the number of (overlapping) occurrences of the pattern in the string."""
    result = re.search(pattern, string)
    if result:
        return 1 + num_matches(pattern, string[result.start() + 1:])
    else:
        return 0