@field_validator('{{name}}')
    def pattern_{{name}}(cls, v):
        pattern=re.compile(r"{{pattern}}")
        if isinstance(v,list):
            for element in v:
                if isinstance(v, str) and not pattern.match(element):
                    raise ValueError(f"Invalid {{name}} format: {element}")
        elif isinstance(v,str):
            if not pattern.match(v):
                raise ValueError(f"Invalid {{name}} format: {v}")
        return v
