First, let's define regret. Marcel Zeelenberg, a scholar of economic psychology and behavioral economics, defines regret as "the negative, cognitively based emotion that we experience when realizing or imagining that our present situation would have been better had we acted differently... Because of this cognitive process of comparing outcomes to 'what might have been' regret has been called a counterfactual emotion."
"Counterfactual" means something that didn't happen. So the emotion of regret can be triggered by thoughts of an alternative, presumably better reality that didn't come to pass because we were too scared/lazy/stupid to take action in the past.
While lingering regrets can make us feel lousy, scientists believe the pain of regret serves an important evolutionary purpose. Giorgio Coricelli at the University of Southern California is a neuroeconomist who studies the role of regret in decision making. He writes that emotions, rather than interfering with our ability to make rational decisions, can in fact nudge us toward behaving even more rationally.
The aching feeling of regret, it turns out, can be a great teacher. Over time, the pain of past experience will prompt us to act differently in the future. On an evolutionary level, if our distant ancestors regretted dropping a rock on their foot or losing their mate to a rival, they would learn to make better future decisions that were more likely to ensure their survival and reproductive success. In a similar way, if you regret not asking Jessica to the prom in high school, you may be less likely to chicken out with the new girl in accounting.
In 2017, social psychologist Shai Davidai at the New School for Social Research published a cool paper on regret with his colleague Thomas Gilovich at Cornell University. The paper includes a quote from "The Top Five Regrets of the Dying," a book written by palliative nurse Bonnie Ware. The most commonly cited deathbed regret was, "I wish I'd had the courage to live a life true to myself, not the life others expected of me."