import re


def get_sub_dirs(links, base_url):
    """gets sub-directories from list of links

    Parameters
    ------
    links (list): list of links, contains files and sub-directories
    regex (str): filter links based on a regular expression

    Returns
    ------
    list: only the links that point to sub-directories are returned
    """
    sub_dirs = [f"{base_url}{link}" for link in links if re.search(r'/$', link)]
    return sub_dirs