import re


def get_doc_from_docstr(string, regex):
    """
    Get the type, signature, description and other information
    from docstrings.

    Args:
        string (str): The string to check
        regex (re.Pattern): The pattern to use

    Returns:
        Dict[str] or Dict[]: The type, signature and description of
        the string. An empty dict will be returned if the string begins
        with "->skip" or there was no information found
    """
    data = {}
    if not string:
        return {}

    string = string.strip()

    if string.startswith("->skip"):
        return {}

    string = string.split("-----")[0]

    finds = regex.findall(string)
    current_key = ""
    if finds:
        for find in finds:
            if find[0].startswith("->"):
                current_key = find[0][2:].strip()
                continue

            if not current_key:
                continue

            # remove useless whitespace
            value = re.sub("  +", "", find[1].strip())
            data[current_key] = value
            current_key = ""

    return data