Regret & Repentance
(Firstly, I am not an ulama, ie, a scholar of Islam, yet this article contains points pertaining to Aqeedah (practical faith). If any point or implication here contradicts the orthodox ulamas' view, please take their opinions over mine)
Humans sin and err. Thus, we should feel guilt and regret for our mistakes, so that we try to make up for and not repeat them. However, these very feelings often pin us down and erode our self-esteem. So what is the way of Islam? There are two commands- apparently opposing, but not so as will be seen later.
The first one is repentance. In His Mercy and recognition of humanity's inclination to sin, Allah forgives our slip-ups on three conditions: 1) Leave the sin now 2) Pledge not to repeat it 3) Feel hatred towards it. In sum, treat the sin as the scourge.
The second command comes from a Hadith, where the Prophet (SAW) states: "Do not say 'If only i had done X', but rather, 'Allah decrees as He wishes'". In other words, we shouldn't wish to change our past actions, but rather accept them as God's Will.
So how are these two reconciled? We should hate our sins, yet not want to change what we had done?
Actually, they're more similar than one might expect. Both ask us to leave the past and build now. In fact, they're complementary- how can you focus your efforts on avoiding sin now if you keep thinking of changing your previous mistakes? It's way too difficult.
An often-used epiphany in stories and films is striking a balance between guilt and moving forward- the character regrets what he/she did and pledges not to repeat said mistake; he/she realizes what they did was in the past and try to do their best in the present. Like the killer who repents and tries to save lives. The over-selfish dude who becomes very benevolent in the end. And so on. Point is, such epiphanies show the characters doing good now, rather than wallowing over their past deeds.
One last point: an intellectual and spiritual star of the modern age, Said Nursi, wrote that if patience is not scattered to the past and the future, it will always suffice for the present. To conclude, realize what you did wrong, fix what you can in the present, and leave everything else to Allah. Simple, right?