How long can you keep raw eggs before you should discard?

How long will boiled eggs keep in the refrig before having to discard?

with the fresh eggs, I always go maybe 2-3 days passed the expiration date becasue that is usually a sell by date for the markets before they have to throw them away.