On regularity lemmas and their applications