import re


def run_job(answer: str, job: dict, grade: float, feedback: str):
    """
    Match answer to regex inside job dictionary.
    Add weight to grade if successful, else add comment to feedback.

    :param answer: Answer.
    :param job: Dictionary with regex, weight, and comment.
    :param grade: Current grade for the answer.
    :param feedback: Current feedback for the answer.
    :return: Modified answer, grade, and feedback.
    """
    match = re.search(job["regex"], answer)

    if match:
        grade += job["weight"]
        answer = answer.replace(match[0], "", 1)
    else:
        feedback += job["comment"] + "\n"

    return answer, grade, feedback