Execute function only for specific user roles

You can exclude certain roles like this:

1- Create a function to check if the current user role is excluded:

function isPasswordValidationSkipped()
{
    // Fill this array with roles that you want to exclude from password validation
    $excludedRoles = ['subscriber'];

    $user = wp_get_current_user();
    foreach ($user->roles as $role) {
        if(in_array($role, $excludedRoles)) {
            return true;
        }
    }
    return false;
}

2- Then use that function inside “validateComplexPassword” Like this:

function validateComplexPassword( $errors ) {

    $password = ( isset( $_POST[ 'pass1' ] ) && trim( $_POST[ 'pass1' ] ) ) ? $_POST[ 'pass1' ] : null;

    if ( true === isPasswordValidationSkipped() || empty( $password ) || ( $errors->get_error_data( 'pass' ) ) )
        return $errors;

    $passwordValidation = validatePassword($password);

    if ( $passwordValidation !== true ) {
        $errors->add( "pass", "<strong>ERROR</strong>: " . $passwordValidation . "." );
    }

    return $errors;
}