Recently, I have seen the sentence
I should've known better than to get my hopes up.
What does it mean?
I couldn't find any explanation about the grammatical structure I've mentioned in the title. Please explain this grammatical structure.
Recently, I have seen the sentence
I should've known better than to get my hopes up.
What does it mean?
I couldn't find any explanation about the grammatical structure I've mentioned in the title. Please explain this grammatical structure.
"Know" can be followed by a to-infinitive:
He knew to be careful [= he knew that he needed to be careful]
Very often, "know" is followed by a negated to-infinitive:
We knew not to antagonise him.
"Know better than to" has a very similar meaning to "know not to".
As Colin Fine says, you can also learn "know better than to" as an idiom. The phrase does in fact have its own entry in some dictionaries:
know better than PHRASE Be wise or polite enough to avoid doing a particular thing. 'you ought to know better than to ask that’ https://www.lexico.com/definition/know_better_than
The word better here is a noun, meaning something that is better: Merriam-Webster better
noun 1a : something better (see better entry 1) I expected better from them
So, it means
I should've known something better than to get my hopes up.
There, something better would be another reaction than getting my hopes up, such as not having any expectations.
to get my hopes up is an infinitival clause expressing the reaction that he regrets.
To not have expectations would have been better than to get my hopes up.