All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
This regret is something good, and it is a sign of a sincere repentance. Moreover, regret is the greatest pillar of repentance, as it was narrated in the Hadeeth: “Regret is repentance.” [Ahmad and At-Tirmithi]
If a person wishes that the had not committed the sin, then this is not something dispraised; rather, it is a sign of remorse, and it is not included in the prohibition of saying ‘if I had done such-and-such…’, because the prohibition of this saying is only when one says it as a matter of discontent with the Decree of Allah and objecting to His Predestination, but if one says it to blame his own self, then there is nothing wrong with it; rather, this is what every sinner should say.
Allah Knows best.