#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(GET)\s(.+)\s(HTTP\/\d+\.\d+)\n(Host):\s(.+)$\n(Cache-Control):\s(.+)$\n(Postman-Token):\s(.+)$"
Local $sString = "GET /v1/search?q=bob%20dylan&type=artist HTTP/1.1" & @CRLF & _
"Host: api.spotify.com" & @CRLF & _
"Cache-Control: no-cache" & @CRLF & _
"Postman-Token: e2f09f98-f"
Local $sSubst = "{ headers: \n\t{ $4 '$5',\n\t '$6': '$7',\n\t '$8': '$9'\n\t}, \n\tverb: '$1',\n\tpath: '$2',\n\tprotocol: '$3'\n}"
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