I'm glad they got caught. That will 'teach them a lesson'! [=they will learn that they should not do that again]
We 'learned our lesson' the hard way. [=we learned from an unpleasant experience]
They studied the 'lessons' [='teachings'] of the great philosophers.
(..) We see you've served years of a life sentence? -Yes, sir. -You feel you've been rehabilitated? Yes, sir. Absolutely, sir. I mean, I learned my lesson. I can honestly say that I'm a changed man. I'm no longer a danger to society. That's God's honest truth. Hey, Red. (..)1994 The Shawshank Redemption