Muwatta Malik, Book 16, Hadith 54 (USC-MSA)

Yahya related to me from Malik from Abu'z Zinad from al-Araj from Abu Hurayra that the Messenger of Allah, may Allah bless him and grant him peace, said, "The Hour will not come until a man passes by the grave of another and says, 'If only I were in his place.' "

وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏:‏ ‏ "‏ لاَ تَقُومُ السَّاعَةُ حَتَّى يَمُرَّ الرَّجُلُ بِقَبْرِ الرَّجُلِ فَيَقُولُ يَا لَيْتَنِي مَكَانَهُ ‏" ‏ ‏.‏

sunnah.com

also referenced under: Book 16, Hadith 576 (In-Book)