import re


def extract_image_ids(sql_path, regex):
    """Extract image IDs from the SQL export

    String -> List(String)
    """

    sql_file = open(sql_path, 'r')

    ids = [url.split('/').pop()
                   for line in sql_file.readlines()
                   for url in re.findall(regex, line)]
    sql_file.close()

    return ids