例例文
I learned the hard way that you should always back up your files.
ファイルは必ずバックアップを取るべきだと痛い目にあって学んだ。
EN英英で言うと
to learn something from your own bad experience
源語源・イメージ

楽な方法ではなく、苦しい経験(the hard way)を通して、という意味。
!入試ポイント
learn (that) ~ the hard way の形。
痛い目にあって身をもって学ぶ。learn the hard way that S V / learn it the hard way の形。the hard way は副詞的に働き、前置詞は付けない(× in the hard way)。失敗談とセットで、I learned the hard way that ~ と使うのが典型。
同じ意味learn from bitter experience
覚覚え方
楽な道(the easy way)ではなく、つらい道(the hard way)を通って学ぶ、と考える。do it the hard way(わざわざ大変なやり方でやる)も同じ the ~ way の副詞用法。
Q入試形式の例題
I lost all my photos when my phone broke. I learned the way that you should always back up your data.
「痛い目にあって学ぶ」は learn ~ the hard way で、hard 以外の形容詞には置き換えない決まった形。difficult / tough / painful も意味は近いが、the difficult way などとは言わない。