Pregnancy question

Will a pregnancy test be accurate if you take it to days before your expected missed period? Also, my periods are very irregular.