Create a custom validation for a doctype data field

I would like to create a doctype where some fields need to follow a certain pattern. I thougt about a validation system and it seems that such system already exists for Data fields: emails, phone, … (Field Types)

I would like to create my own validations with regex.

Is it possible ? How should I do?



I used a Controler method: validate()