from typing import Pattern


def parse_substring(full_string: str, rex: Pattern[str]) -> str | None:
    """Parse an url for substring matching the given regular expression.

    Args:
        url (str): String representation of the URL
        rex (Pattern[str]): String represenation of a regular expression

    Returns:
        str: Substring matching the given pattern
        None: If no matching substring is found
    """
    substring = ""
    try:
        match = rex.search(full_string)
        if match:
            substring = match.group(1)
            return substring
        print(f"No matching substring found from input '{full_string}'...")
        return None
    except IndexError as ex:
        print(f"No group(1) found in {full_string}")
        print(f"{ex}")
        return None