Custom password format

I need to validate an identifier parameter of the user’s profile so that it does not allow this value in the password.
example the date of birth or the DNI.

This is possible???