def match_pattern(regex):
prog = re.compile(regex)<EOL>def checker(v):<EOL><INDENT>result = prog.match(v)<EOL>if result is None:<EOL><INDENT>raise ValueError(v)<EOL><DEDENT><DEDENT>return checker<EOL>
Return a value check function which raises a ValueError if the value does
not match the supplied regular expression, see also `re.match`.