def match_pagination(ref_line):
    """Remove footer pagination from references lines"""
    pattern = ur'\(?\[?(\d{1,4})\]?\)?\.?\s*$'
    re_footer = re.compile(pattern, re.UNICODE)
    match = re_footer.match(ref_line)
    if match:
        return int(match.group(1))
    return None
Remove footer pagination from references lines