import re


def replace_location(match: re.Match, location: str) -> str:
    """Replace location data in the warning string."""
    text = match.string
    start, end = match.span(2)
    return text[:start] + location + text[end:]