I said, "A man divorced his wife while she was menstruating."He asked, "Do you know Abdullah bin Umar?"I said, "Yes."He said, "Abdullah bin Umar divorced his wife while she was menstruating, so Umar went to the Prophet ﷺ and asked him about it. The Prophet ﷺ said, 'Order him to take her back, then let him divorce her at the start of her waiting period.'"I asked, "Does that divorce count?"He replied, "What else? What do you think if he proves incapable and acts foolishly?"
حدثنا القعنبي حدثنا يزيد يعني ابن إبراهيم عن محمد بن سيرين حدثني يونس بن جبير قال سألت
قلت رجل طلق امرأته وهي حائض قال أتعرف عبد الله بن عمر قلت نعم قال فإن عبد الله بن عمر طلق امرأته وهي حائض فأتى عمر النبي ﷺ فسأله فقال مره فليراجعها ثم ليطلقها في قبل عدتها قال قلت فيعتد بها قال فمه أرأيت إن عجز واستحمق
Bukhari narrated it in the Book of Divorce, chapter on taking back the divorced wife during menstruation, hadith no. 5333, from the hadith of Yazid bin Ibrahim, with this wording. Muslim also narrated it, see the previous hadith.