Formal Written English
There are quite a few possible ways to join up conditionals using one or another past-tense form. Here are just a few of them:
- If it was yesterday, I bought the car.
- If it was yesterday, I will have bought the car.
- If it was yesterday, I must have bought the car.
- If it were yesterday, I would buy the car.
- If it were yesterday, I would have bought the car.
- If it had been yesterday, I would have bought the car.
To express regret at not having done something in the past, then the consequent should be a perfect construction. Therefore you need have bought in the second clause, and so only the last two are possible for the sense you looking for.
Some folks might prefer 6 over 5, so that there is a compound tense in both the first part of the conditional (fancy name: protasis) and in its consequent (fancy name: apodosis).
But there really is no difference between them, and no one could ever find an iota of meaning-shift by electing 5 over 6 or 6 over 5.
Informal Written English
People don’t much talk precisely the way those are written above. That’s because in the speech of any register lower than that of true oratory (such as in a formal delivery from a preacher, a judge, or in olden days, a politician) native speakers will virtually always contract the auxiliaries. They just don’t always choose the same ones to contract.
In normal conversation, that same sixfold set given above therefore runs more like this:
- If it was yesterday, I bought the car.
- If it was yesterday, I’ll have bought the car.
If it was yesterday, I’ll’ve bought the car.
- If it was yesterday, I must’ve bought the car.
- If it were yesterday, I’d buy the car.
- If it were yesterday, I’d have bought the car.
If it were yesterday, I would’ve bought the car.
If it were yesterday, I’d’ve bought the car.
- If it’d been yesterday, I would’ve bought the car.
If it’d been yesterday, I’d have bought the car.
If it’d been yesterday, I’d’ve bought the car.
Spoken English
Although I’m still using the accepted standard orthography for the contractions, you as a nonnative speaker should understand that the conventions of writing do not reflect the actual pronunciations.
Rather, actual pronunciations of -d’ve are nearly always rendered as unstressed /də/
in speech.
You will sometimes see this reflected in eye dialect in reported conversation, such as woulda/coulda/shoulda, or even Ida.
I don’t recommend that, however.
Literary English
To swing the other direction towards a more formal or literary register, these possibilities exist:
- If it was yesterday, I bought the car.
- If it was yesterday, I will have bought the car.
- If it was yesterday, I must have bought the car.
- Were it yesterday, I would buy the car.
- Were it yesterday, I would have bought the car.
- Had it been yesterday, I would have bought the car.
Probably the most interesting thing about this third set is that inversion and consequent if-deletion is possible only in the true hypotheticals alone, not in the other situations.