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.
(..) A couple of men were killed. It's about time you rebels learned you can't take the law into your own hands. What are you laughing at? This isn't your night to teach that lesson, Tom. These two have been with me tonight. Yes, sir. With you, Rhett? Where? (..)1939 Gone with the Wind