from typing import Dict
from typing import Pattern
import re


def satisfy_regex_match(model: Dict[str, str], pattern: Pattern,
                        field_to_check: str):
    """Check whether model (job or build) should be included according to
    the user input.
    The model should be added if the information provided field_to_check
    (the model name or url for example) is matches the regex pattern.

    :param model: model information obtained from jenkins
    :type model: str
    :param pattern: regex patter that the model name should match
    :type pattern: :class:`re.Pattern`
    :param field_to_check: model field to perform the check
    :param field_to_check: str
    :returns: Whether the model satisfies user input
    :rtype: bool
    """
    return re.search(pattern, model[field_to_check]) is not None