I forgot to lock the door.（1）
I forgot locking the door.（2）
I forgot to post the letter．
I forgot posting the letter．
They stopped to chat.
They stopped chatting.
I reminded him to attend the meeting yesterday．
I reminded him of his attending the meeting yesterday.
You must remember to turn off the lights when you leave the room．
You remembered turning off the lights when you left the room，did you？
I regret to say he was a liar．
I regret saying he was a liar.
We gave the porter ten dollars to carry our luggage.
We gave the porter ten dollars for carrying our luggage.
从以上各组例句可见，动词不定式to say和to carry等等的动作是发生在谓语动词regret和gave等等之后；动名词saying和carrying等等的动作是发生在谓语动词regret和gave等等之前。