Wishes about the past
wish / if only + past perfect subjunctive
This pattern is used to express wishes or regrets about the past:
I wish I had never told him my secret. (I'm sorry that I told him my secret)
Santiago wishes he hadn't spent so much money last night. (Santiago regrets spending so much money last night)
Instead of the past perfect subjunctive, we can use could + perfect infinitive:
If only I could have been there. I'm sure it was a great concert. (I'm sorry that I couldn't be there)