import re def md5_validate(v: str) -> bool: md5_pattern = re.compile(r'^[a-fA-F0-9]{32}$') # 匹配字符串 if md5_pattern.match(v): return True return False