Here is a good question... Why does God have regrets? Why does God have emotion? He is a perfect being. Should He be emotionless? For example, this is what Numbers 23:19 say.
YLT Num 23:19 God is not a man--and lieth, And a son of man--and repenteth! Hath He said--and doth He not do it? And spoken--and doth He not confirm it?
Let's take a look at some verses:
YLT Genesis 6:6 and Jehovah repenteth that He hath made man in the earth, and He grieveth Himself--unto His heart.
YLT Genesis 6:7 And Jehovah saith, 'I wipe away man whom I have prepared from off the face of the ground, from man unto beast, unto creeping thing, and unto fowl of the heavens, for I have repented that I have made them.'
YLT Exodus 20:5 Thou dost not bow thyself to them, nor serve them: for I, Jehovah thy God, am a zealous God, charging iniquity of fathers on sons, on the third generation, and on the fourth, of those hating Me,
YLT Exodus 20:6 and doing kindness to thousands, of those loving Me and keeping My commands.
YLT Exodus 32:12 why do the Egyptians speak, saying, For evil He brought them out to slay them among mountains, and to consume them from off the face of the ground? turn back from the heat of Thine anger, and repent of the evil against Thy people.
YLT Exodus 32:13 'Be mindful of Abraham, of Isaac, and of Israel, Thy servants, to whom Thou hast sworn by Thyself, and unto whom Thou speakest: I multiply your seed as stars of the heavens, and all this land, as I have said, I give to your seed, and they have inherited to the age;'
YLT Exodus 32:14 and Jehovah repenteth of the evil which He hath spoken of doing to His people.
YLT Deuteronomy 32:36 For Jehovah doth judge His people, And for His servants doth repent Himself. For He seeth--the going away of power, And none is restrained and left.
As you can see from these verses, God can experience full range of emotions that are familiar to us: jealousy, mercy, rage, regret, repentance e.t.c. Why?
This is because we were made in the image of God (Genesis 1:26-27) and because we are just like God in knowing good and evil (Genesis 3:22) , which here means full range of emotions, good and bad.
So, in reality, even though God "seem" to make mistakes and have regrets, it does not make Him less holy. God planned these regrets from the beginning. He is basically throwing a farce. This is because God wants us to know that He understand us (since we are like Him) and we should not be afraid of him if we follow His holy Law (Written Torah). As you can see from Exodus 20:6, He is doing KINDNESS to those who love Him and keep His commandments with all the heart and the soul. So God having emotion is a good thing, otherwise we could not hope that He would have mercy or kindness on us. God is not a computer or a robot-judge. He is the LIVING and the FEELING being, just like us!