I regret eating so much junk food. = right
I regret to eat so much junk food. = wrong
When used to look back on something in the past, the verb 'regret' has to be followed by a gerund. If you regret doing something, this means that you did something and now wish that you hadn't done it e.g. "I regret drinking that tenth beer last night." You cannot use an infinitive in this context.
The only time we use 'regret' with an infinitive is in the formal and formulaic "I regret to tell you that... " or "I regret to inform you that... ". This is forward-looking, and is a different meaning of the word. It's a set phrase which means 'Unfortunately, it is my duty to tell you'.
I hope that makes sense.