The Prophet ﷺ said: “Be keen on what benefits you, seek Allah's help, and do not be helpless. If something befalls you, do not say ‘If only I had done such,’ but say ‘Allah decreed, and what He willed He did,’ for ‘if only’ opens the door to the work of Shayṭān.” (Muslim).
العربية: عن أبي هريرة رضي الله عنه أنّ رسول الله ﷺ قال: «احرِص على ما ينفعك واستعن بالله ولا تعجَز، وإن أصابك شيءٌ فلا تقل: لو أني فعلتُ كان كذا، ولكن قل: قدّر الله وما شاء فعل، فإنّ لو تفتح عمل الشيطان». (مسلم).
When things go wrong, say ‘Qaddara-llāhu wa mā shāʾa faʿal’ — not ‘if only.’