import re


def _validate_regex(value: str, regex: str) -> bool:
    """Validate that the value is a string that matches a regex."""
    compiled = re.compile(regex)
    if not compiled.match(value):
        return False
    return True