learn a/ lesson

learn a/your lesson

to understand something because of an unpleasant experience We learned a lesson from last year's failure to reform health care. You hope that prisoners will say, “I don't want to end up back in jail again – I've learned my lesson.”
See also: learn, lesson