import re


def yugioh_card_in_string(string, cards_json, card_id_regex, card_name_regex):
    """Given a string, find a yugioh card and return that it."""
    id_match = re.search(card_id_regex, string)
    if id_match is not None:
        for card in cards_json:
            if card["id"] == int(id_match.group(0)):
                return card
        assert False, "Should be unreachable"
    name_match = re.search(card_name_regex, string)
    if name_match is not None:
        for card in cards_json:
            if card["name"].lower() == name_match.group(0).lower():
                return card
        assert False, "Should be unreachable"
    return None