this invention relates to a method for detecting cancer cells in a subject . the method includes contacting a plurality of cells in a sample obtained from the subject with carbazole compounds of the following formula : and calculating the percentage of the cells that emit florescence upon irradiation with an excitation light , in which , if the percentage is above a pre - set value , the subject is determined to contain cancer cells . in the above formula , each of rings a and b , independently , is heteroaryl containing at least one nitrogen atom ; each of x and y , independently , is ch or n ; each of r 1 — r 6 , independently , is h , c 1 - c 8 alkyl , c 2 - c 8 alkenyl , c 2 - c 8 alkynyl , c 3 - c 8 cycloalkyl , c 3 - c 8 heterocycloalkyl , aryl , heteroaryl , oh , c 1 - c 6 alkoxy , aryloxy , heteroaryloxy , nh 2 , c 1 l - c 6 alkylamino , c 1 - c 12 dialkylamino , arylamino , diarylamino , or halogen ; r 7 is h , c 1 - c 8 alkyl , c 2 - c 8 alkenyl , c 2 - c 8 alkynyl , c 3 - c 8 cycloalkyl , c 3 - c 8 heterocycloalkyl , aryl , heteroaryl ; and each of m and n , independently , is 1 , 2 , or 3 .