from typing import Dict
from typing import List
import re


def find_icomoon_icon_not_in_new_icons(icomoon_icon: Dict, new_icons: List, messages: List):
    """
    Find all the icomoon icons that are not listed in the new icons.
    This also add logging for which icons were removed.
    :param icomoon_icon - a dict object from the icomoon.json's `icons` attribute.
    :param new_icons - a list of new icons. Each element is an object from the `devicon.json`.
    :param messages - an empty list where the function can attach logging on which 
    icon were removed.
    """
    for new_icon in new_icons:
        pattern = re.compile(f"^{new_icon['name']}-")
        if pattern.search(icomoon_icon["properties"]["name"]):
            message = f"-'{icomoon_icon['properties']['name']}' cause it matches '{new_icon['name']}'"
            messages.append(message)
            return False
    return True