#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "^.+version(.*) character file\.([\n\r]+)(\d+)([^\(]+) \([^\d]+( \d+),.+\n\s+.+as a(.+) on.+\n\s+(?:Was.+One\.\n)?((?:.|\n)+[!.])\n(?:.|\n)+\((\d+)(?:.|\n)+$"
Local $sString = " Dungeon Crawl Stone Soup version 0.16-a0-3667-g690a316 (webtiles) character file." & @CRLF & _
"" & @CRLF & _
"462 8Escape the Ruffian (level 6, -2/47 HPs)" & @CRLF & _
" Began as a Bearkin Transmuter on Jan 31, 2015." & @CRLF & _
" Slain by an orc" & @CRLF & _
" ... wielding a +0 trident" & @CRLF & _
" (3 damage)" & @CRLF & _
" ... on level 4 of the Dungeon." & @CRLF & _
" The game lasted 00:28:53 (3698 turns)." & @CRLF & _
"" & @CRLF & _
"8Escape the Ruffian (Bearkin Transmuter) Turns: 3698, Time: 00:28:53"
Local $sSubst = "Version:$1\nScore: $3\nName:$4\nCharacter:$6\nLevel:$5\nCause of Death/Victory: $7\nTurns: $8"
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