The Buddha describes how to see the three sensations - pleasant, painful, and neither-painful-nor-pleasant.
Dutiyavedanā sutta - Sensations (Second)
This was said by the Blessed One, said by the Arahant, as I have heard:
"There are these three sensations, bhikkhus. What three? Pleasant sensation, painful sensation, and neither-painful-nor-pleasant sensation. Bhikkhus, a pleasant sensation should be seen as suffering; a painful sensation should be seen as a thorn; a sensation that is neither-painful-nor-pleasant should be seen as impermanent. When a bhikkhu sees a pleasant sensation as [ultimately] dissatisfying, a painful sensation as a thorn, and a sensation that is neither-painful-nor-pleasant as impermanent, he is called noble, one with perfect understanding, who has completely cut off craving, unravelled the fetters, and through full understanding of conceit, has made an end of suffering."
The Blessed One spoke on this matter. In this regard, it is said:
"One who sees pleasure as ultimately dissatisfying, who sees pain as a thorn; And who sees the peaceful, neither-painful-nor-pleasant sensation, as impermanent—
That bhikkhu, through perfect understanding, is liberated at that very point; Fully accomplished in direct knowing, tranquil, is a sage who has gone beyond the yoke."
This matter too was spoken by the Blessed One, as I have heard.