When do I take a pregnancy test if my period is irregular ?

When should I take a test if my period is irregular