#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?<level>\d+)\s*(?<wood>\d+)\s*(?<clay>\d+)\s*(?<iron>\d+)\s*(?<crop>\d+)\s*(?<cropusage>\d+)\s*(?<time>\d+:\d+:\d+)\s*(?<pop>\d+)\s*(?<production>\d+)"
Local $sString = "1 70 90 70 20 0 00:02:30 1 7" & @CRLF & _
"2 115 150 115 35 0 00:07:20 1 13" & @CRLF & _
"3 195 250 195 55 0 00:15:00 2 21" & @CRLF & _
"4 325 420 325 95 0 00:27:30 2 31" & @CRLF & _
"5 545 700 545 155 0 00:47:10 2 46" & @CRLF & _
"6 910 1170 910 260 1 01:18:50 3 70" & @CRLF & _
"7 1520 1950 1520 435 1 02:03:40 4 98" & @CRLF & _
"8 2535 3260 2535 725 1 03:30:40 4 140" & @CRLF & _
"9 4235 5445 4235 1210 1 05:40:30 5 203" & @CRLF & _
"10 7070 9095 7070 2020 1 09:08:00 6 280" & @CRLF & _
"11 11810 15185 11810 3375 1 14:40:10 7 392" & @CRLF & _
"12 19725 25360 19725 5635 1 23:31:40 9 525" & @CRLF & _
"13 32940 42350 32940 9410 1 37:41:50 11 693" & @CRLF & _
"14 55005 70720 55005 15715 1 60:22:20 13 889" & @CRLF & _
"15 91860 118105 91860 26245 1 96:39:10 15 1120" & @CRLF & _
"16 153405 197240 153405 43830 2 154:41:50 18 1400" & @CRLF & _
"17 256190 329385 256190 73195 2 247:34:20 22 1820" & @CRLF & _
"18 427835 550075 427835 122240 2 396:10:10 27 2240" & @CRLF & _
"19 714485 918625 714485 204140 2 633:550: 32 2800" & @CRLF & _
"20" & @CRLF & _
" 1193195 1534105 1193195 340915 2 1014:20:30 38 3430"
Local $sSubst = "<Level val="${level}"><Resources><Wood>${wood}</Wood><Clay>${clay}</Clay><Iron>${iron}</Iron><Crop>${crop}</Crop><CropUsage>${cropusage}</CropUsage></Resources><UpgradeTime>${time}</UpgradeTime><Population>${pop}</Population><Production>${production}</Production></Level>"
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