Abu Hurairah reported,

The Messenger of Allah ﷺ said, "Whoever swears an oath and then sees that something else is better than it, let him do what is better and make expiation for his oath." This carries the same meaning as the report of Malik, "Let him make expiation for his oath and do what is better."

Muslim 4274

Sahih

و حدثني القاسم بن زكرياء حدثنا خالد بن مخلد حدثني سليمان يعني ابن بلال حدثني سهيل في هذا الإسناد بمعنى حديث مالك فليكفر يمينه وليفعل الذي هو خير

مسلم 4274صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Oaths
Chapter
Recommendation for one who swore an oath then saw something better to do what is better and expiate for his oath
Numbering
Darussalam 4274
Muslim 4274