import re


def utc_offset_string_to_seconds(utc_offset: str) -> int:
    """match a UTC offset in format ±[hh]:[mm], ±[h]:[mm], or ±[hh][mm] and return number of seconds offset"""
    patterns = ["^([+-]?)(\d{1,2}):(\d{2})$", "^([+-]?)(\d{2})(\d{2})$"]
    for pattern in patterns:
        match = re.match(pattern, utc_offset)
        if not match:
            continue
        sign = match.group(1)
        hours = int(match.group(2))
        minutes = int(match.group(3))
        if sign == "-":
            hours = -hours
            minutes = -minutes
        return (hours * 60 + minutes) * 60
    else:
        raise ValueError(f"Invalid UTC offset format: {utc_offset}.")