Are we our own prisoners?

Sometimes, we are also prisoners of our thoughts and our past deeds. We also have nothing else to look forward to. We only have regrets. At least, we can do something about the conditions, but the prisoners can do nothing. Life can be depressing at times. How to inspire ourselves in such conditions?