Wish - past
subject + wish + subject + had + past participle (past perfect)
I wish I hadn't said that.
expressing regrets about the past
You can use wish + past perfect to express a regret about something that happened in the past.
The past perfect is used to show that what you wish is unreal:
Reality: I lost the book. (Past simple tense)
Wish: I wish I hadn't lost the book.
Reality: I didn't go to the party. (Past simple tense)
Wish: I wish I had gone to the party.
Reality: I said something unkind to Sally.
Wish: I wish I hadn't said that.