For the kind of sorrow God wants us to experience leads us away from sin and results in salvation. There’s no regret for that kind of sorrow. But worldly sorrow, which lacks repentance, results in spiritual death.
When God saw what they did, how they turned from their evil way, God relented of the disaster that he had said he would do to them, and he did not do it.