#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(\d+\.)\s+([\w\-#]+)\s+(\{[^\}]+\})\s+\1\.+\s+([\w\-#]+)\s+(\{[^\}]+\})"
Local $sString = "[Event "Live Chess"]" & @CRLF & _
"[Site "Chess.com"]" & @CRLF & _
"[Date "2018.12.07"]" & @CRLF & _
"[Round "-"]" & @CRLF & _
"[White "Joerg64"]" & @CRLF & _
"[Black "Damir_Khamzin"]" & @CRLF & _
"[Result "0-1"]" & @CRLF & _
"[WhiteElo "1317"]" & @CRLF & _
"[BlackElo "1312"]" & @CRLF & _
"[TimeControl "1800"]" & @CRLF & _
"[EndTime "9:36:56 PST"]" & @CRLF & _
"[Termination "Damir_Khamzin поставил мат"]" & @CRLF & _
"" & @CRLF & _
"1. d4 {[%clk 0:29:59.9]} 1... d5 {[%clk 0:29:57.6]} 2. c4 {[%clk 0:29:50.5]}" & @CRLF & _
"2... e6 {[%clk 0:29:52.9]} 3. a3 {[%clk 0:29:46.5]} 3... h6 {[%clk 0:29:27.5]}" & @CRLF & _
"4. Nc3 {[%clk 0:29:44.3]} 4... Nf6 {[%clk 0:29:24.7]} 5. h3 {[%clk 0:29:41.2]}" & @CRLF & _
"5... Nbd7 {[%clk 0:29:07.7]} 6. Nf3 {[%clk 0:29:23.2]} 6... Be7 {[%clk 0:28:59]}" & @CRLF & _
"7. e3 {[%clk 0:29:17.7]} 7... b6 {[%clk 0:28:49.7]} 8. Bd3 {[%clk 0:29:05.4]}" & @CRLF & _
"8... Bb7 {[%clk 0:28:39]} 9. b4 {[%clk 0:28:29.3]} 9... c5 {[%clk 0:28:01.5]}" & @CRLF & _
"10. b5 {[%clk 0:28:18.5]} 10... dxc4 {[%clk 0:27:46.4]} 11. Bxc4 {[%clk" & @CRLF & _
"0:28:15.2]} 11... cxd4 {[%clk 0:27:38]} 12. exd4 {[%clk 0:27:57.6]} 12... O-O" & @CRLF & _
"{[%clk 0:27:28.5]} 13. O-O {[%clk 0:27:54.6]} 13... Qc7 {[%clk 0:27:05.4]} 14." & @CRLF & _
"Re1 {[%clk 0:26:46.2]} 14... Qxc4 {[%clk 0:26:28.7]} 15. Ne5 {[%clk 0:26:11.3]}" & @CRLF & _
"15... Qxc3 {[%clk 0:26:04.9]} 16. Bf4 {[%clk 0:25:46.4]} 16... Nxe5 {[%clk" & @CRLF & _
"0:25:52.3]} 17. dxe5 {[%clk 0:25:38.1]} 17... Nd5 {[%clk 0:25:40.1]} 18. Bh2" & @CRLF & _
"{[%clk 0:25:27.6]} 18... Bxa3 {[%clk 0:24:33]} 19. Rb1 {[%clk 0:24:42.4]} 19..." & @CRLF & _
"Bc5 {[%clk 0:24:13.6]} 20. Re2 {[%clk 0:24:27.9]} 20... Qd4 {[%clk 0:22:45.6]}" & @CRLF & _
"21. Rd2 {[%clk 0:24:21.1]} 21... Qh4 {[%clk 0:22:39.6]} 22. Bg3 {[%clk" & @CRLF & _
"0:24:14.8]} 22... Qe7 {[%clk 0:22:35.3]} 23. Rc2 {[%clk 0:20:18.6]} 23... Rad8" & @CRLF & _
"{[%clk 0:21:55]} 24. Qg4 {[%clk 0:20:10.7]} 24... Qg5 {[%clk 0:21:18.3]} 25. Qa4" & @CRLF & _
"{[%clk 0:19:52.9]} 25... Qg6 {[%clk 0:20:48.8]} 26. Kh1 {[%clk 0:19:22.1]} 26..." & @CRLF & _
"Nb4 {[%clk 0:20:21.5]} 27. Rcb2 {[%clk 0:18:39.8]} 27... Ra8 {[%clk 0:19:41.5]}" & @CRLF & _
"28. Rxb4 {[%clk 0:18:22.8]} 28... Bxb4 {[%clk 0:19:38.6]} 29. Qxb4 {[%clk" & @CRLF & _
"0:18:14.3]} 29... Qe4 {[%clk 0:19:22.3]} 30. Qb2 {[%clk 0:17:43.9]} 30... Qxg2#" & @CRLF & _
"{[%clk 0:19:15.9]} 0-1" & @CRLF & _
""
Local $sSubst = "\n\1 \2 \4 \3 - \5"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm