learn one’s lesson
decide not to do something again because it is caused you problems in the past
you’ve learned your lesson
Madam, you broke the law and the fine is $179. I hope you’ve learned your lesson.