Create a custom validation for a doctype data field

Dears,
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?

Thanks

Regards

I used a Controler method: validate()
https://frappeframework.com/docs/user/en/basics/doctypes/controllers