All perfect praise be to Allah
There are no specific sequence of words to repeat for a talaaq to be valid, it just had to be the intention(by any reason) and the words should mean that person is giving divorce. So it can be anything like, i give you divorce, you are divorced, i divorce you or anything.
And these words can be in front of wife or even in her absence, can be verbal or can be written, if the intention was to actually divorce(even if in anger) and it was said or written, divorce is valid.
But, if the intention was there and words were not spoken or written, i.e he did not expressed it. Than divorce is not valid because:
Abu Hurayrah (may Allaah be pleased with him) who said: The Messenger
of Allaah (peace and blessings of Allaah be upon him) said: “Allaah
has forgiven my ummah for whatever crosses their minds, so long as
they do not act upon it or speak of it.” Qutaadah – one of the
narrators of this hadeeth – said: If it said the words of divorce to
himself, without uttering it, it does not mean anything.
PS: If this was said once, the divorce is valid but only 1, and the couple can be together again without a re-marriage(nikah) with-in iddah and with a re-marriage after iddah. And if it was said thrice, than it depends because some schools of thoughts consider it one valid divorce(not 3, if 3 divorce was given in same sitting) and some(specially hanafi) schools of thought consider it 3 valid divorces. So, it depends
Allah knows best