Sahih al-Bukhari, Hadith 1871 ⓘ
Narrated Abu Huraira: Allah's Messenger said, "I was ordered to migrate to a town which will swallow (conquer) other towns and is called Yathrib and that is Medina, and it turns out (bad) persons as a furnace removes the impurities of iron.
حَدَّثَنَا عَبْدُ اللَّهِ بْنُ يُوسُفَ، أَخْبَرَنَا مَالِكٌ، عَنْ يَحْيَى بْنِ سَعِيدٍ، قَالَ سَمِعْتُ أَبَا الْحُبَابِ، سَعِيدَ بْنَ يَسَارٍ يَقُولُ سَمِعْتُ أَبَا هُرَيْرَةَ ـ رضى الله عنه ـ يَقُولُ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم. " أُمِرْتُ بِقَرْيَةٍ تَأْكُلُ الْقُرَى يَقُولُونَ يَثْرِبُ. وَهْىَ الْمَدِينَةُ، تَنْفِي النَّاسَ كَمَا يَنْفِي الْكِيرُ خَبَثَ الْحَدِيدِ " .
also referenced under: Book 29, Hadith 5 (In-Book) & Volume 3, Book 30, Hadith 95 (USC-MSA)