Ruling on using the words “if” or “if only”?
Question

A man said, “If only you had done such and such, none of this would have happened to you.” Another man who heard him said, “This word (if only) was forbidden by the Prophet (peace and blessings of Allah be upon him), it is a word that leads the one who says it to kufr.” A third man said, “The Prophet (peace and blessings of Allah be upon him) said, concerning the story of Moosa with al-Khidr, ‘May Allah have mercy upon Moosa. If only he had had patience, so that Allah would have told us more of what happened between them.’” Another man referred to the hadeeth of the Prophet (peace and blessings of Allah be upon him), “ The strong believer is more beloved to Allah than the weak believer…‘If only” opens the door to the Shaytaan.” Does this abrogate that, or not?
Praise be to Allah.Everything that Allah and His Messenger said is truth. The word ‘if’ or ‘if only’ is used in two ways: 
1.To express grief for the past and distress what has been decreed. This is what is not allowed, as Allah says (interpretation of the meaning):
“O you who believe! Be not like those who disbelieve (hypocrites) and who say to their brethren when they travel through the earth or go out to fight: ‘If they had stayed with us, they would not have died or been killed,’ so that Allah may make it a cause of regret in their hearts”
[Aal ‘Imraan 3:156]
This is what the Prophet (peace and blessings of Allah be upon him) forbade when he said, “If anything happens to you, do not say, ‘If only I had done such and such, then such and such would have happened.’ Say instead, ‘Qaddar Allah wa maa sha’a fa 'ala (Allah decreed and what He wills He does), for ‘If only’ opens the door to the Shaytaan”, i.e., it makes you vulnerable to grief and fear, which is harmful to you and is of no benefit. Know that whatever befalls you, you could not have avoided, and whatever does not happen to you, you could not have made it happen to you, as Allah says (interpretation of the meaning):
“No calamity befalls, but by the Leave [i.e. Decision and Qadar (Divine Preordainments)] of Allah, and whosoever believes in Allah, He guides his heart” [al-Taghaabun 64:11]
They said, this is a man to whom calamity happens, but he knows that it is from Allah, so he accepts it and submits. 
2.When the word ‘if’ is used to convey beneficial knowledge, such as the aayah (interpretation of the meaning):
“Had there been therein (in the heavens and the earth) aalihah (gods) besides Allah, then verily, both would have been ruined” [al-Anbiyaa’ 21:22]
The second type is used to express love for goodness, such as saying, “If only I had what so and so has, I would do what he does.” Saying things like this is permissible.
The hadeeth of the Prophet (peace and blessings of Allah be upon him), “If only he [Moosa] had had patience, so that Allah would have told us more of what happened between them” is of this nature, as is the aayah (interpretation of the meaning):
“They wish that you should compromise (in religion out of courtesy) with them, so they (too) would compromise with you”
[al-Qalam 68:9]
Our Prophet (peace and blessings of Allah be upon him) wished that Allah has told us more of their [Moosa and al-Khidr] story, and he mentioned that in order to point out his love for patience and the results that come from it, and the benefits that it can bring. There was no element of fear, grief or neglect of the duty of patience in the face of what has been decreed.
And Allah knows best.