method compare_type in api (use correct regex)