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
(..) They're in her phone. - Just forget all that, please. - Excuse me. Hi. Forget it. - I need to find Friendship Island. - Look at this. years of piano lessons. Yeah. It looks pretty faded. You know what. Save Chopsticks and Heart and Soul, get rid of the rest. - Are you. (..)2015 Inside Out
(..) of the Black Pearl. What? He failed to mention that. He plays things closer to the vest now. And a hard-learned lesson it was. Three days out, the first mate comes to him and says everything's an equal share. (..)2003 Pirates of the Caribbean: The Curse of the Black Pearl