I want the pattern definition for the username to have common numbers and letters and to get an error if it enters only numbers or only letters
[['user'], 'match', 'pattern' => '/^[A-Za-z0-9_-]+$/i']
check this pattern (positive lookahead):
[['user'], 'match', 'pattern' => '/^(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+)$/']