1 John 1:8-9 "If we say we have no sin, we deceive ourselves, and the truth is not in us. If we confess our sins, he is faithful and just to forgive us our sins and to cleanse us from all unrighteousness."
When you sin, first, repent of your sin and ask God for forgiveness.
John 8:4-11 (ESV) "The scribes and the Pharisees brought a woman who had
been caught in adultery ... he stood up and said to them, “Let him who
is without sin among you be the first to throw a stone at her.” ...
And Jesus said [to the woman], “Neither do I condemn you; go, and from
now on sin no more.”
Then, don't repeat the sin.
Of course we are humans and we fail and we will repeat the sin.
Luke 17:3-4 (ESV) If your brother sins, rebuke him, and if he repents,
forgive him, 4 and if he sins against you seven times in the day, and
turns to you seven times, saying, ‘I repent,’ you must forgive him.”
While this is advice to people and not a description of God, it was the first verse that popped into my head at the moment. If someone sins against us, we should forgive him over and over. It stands to reason that if God demands this behavior from us, he must act it out himself.
As a couple of side notes on the specifics:
Looking at a woman and saying "wow, she's really pretty" is not necessarily lust, and I wouldn't beat myself up every time I notice a woman is pretty. This is certainly debatable, but I think what Jesus meant was that if you look at a woman who is not your wife and want to have sexual relations with her, then the fact that when you asked she slapped you in the face and told you to get lost rather than agreeing has nothing to do with your guilt. You wanted to sin. The fact that you were unable to follow through does not make it okay. Similarly if you are angry and want to kill someone, but his bodyguards stop you from entering the building, you are just as guilty as if you had pulled it off. CS Lewis once wrote that some men are in a position where, when they get angry, they can have thousands of people killed. Others are in a position where, when they get angry, people just ignore them or even laugh at them. But in both cases, they had the same sinful desires in their hearts, so their guilt is the same although the results are different. I think there's nothing wrong with thinking a woman is pretty, as long as you are not wishing to have illicit sexual relations with her.
But that said, if you're married, I would certainly make every effort to concentrate your sexual interest on your wife. That's what marriage is for.