Here is part of a commentary.
Ellicott’s Commentary for English Readers (Matthew 5:28)
To lust after her. - The intent is more strongly marked in the Greek than in
the English. It is not the passing glance, not even the momentary impulse of
desire, but the continued gaze by which the impulse is deliberately cherished
till it becomes a passion. This noble and beautiful teaching, it has often been
remarked, and by way of disparagement, is found elsewhwere. Such disparagement
is out of place. By the mercy of God that “lighteth every man” has led men to
recognize the truth thus asserted, and parallels to it may be found in the
writings of Confucius, Seneca, Epictetus and even of the Jewish Rabbis
themselves. The words of Juvenal closely express the general sentiment:-
“Scelus intra se tacitus qui cogitat ullum, Facti crimen habet.”
“Who in his breast a guilty thought doth cherish,
He bears the guilt of action.”]
Our Lord’s words speak primarily of “adultery”, but are, of course, applicable
to every form of sensual impurity.