Is this a duplicate of validate_match() https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/blob/master/fields/field.php#L312 ?