The fieldName details can be obtained from the openmrs administration module (Patient Attributes). The validators will work for non-attributes as well. For non attributes, you will need to get the field names using some html debuggers.
Patient Name Related Custom Field Validation Configurations
If the format of the patient names need to be changed, the global property patient.nameValidationRegex needs to be updated. This field is used in server side validations by openmrs.
Note
Error message is displayed only when return is false. The specified field should be of non coded value type. If the field is not a patient attribute, the attributeDetails will not be given.