#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)Buy (\d+)\n(.*)\n(.*)\n(.*)\n(.*)\n"
Local $sString = "Buy 1" & @CRLF & _
"0.00161" & @CRLF & _
"19154259" & @CRLF & _
"30,804.1039267" & @CRLF & _
"30,804.1039267" & @CRLF & _
"Buy 2" & @CRLF & _
"0.00160" & @CRLF & _
"97058393" & @CRLF & _
"155,186.3181385" & @CRLF & _
"185,990.4220652" & @CRLF & _
"Buy 3" & @CRLF & _
"0.00159" & @CRLF & _
"41122703" & @CRLF & _
"65,279.2931204" & @CRLF & _
"251,269.7151856" & @CRLF & _
"Buy 4" & @CRLF & _
"0.00158" & @CRLF & _
"31934551" & @CRLF & _
"50,475.4559003" & @CRLF & _
"301,745.1710859" & @CRLF & _
"Buy 5" & @CRLF & _
"0.00157" & @CRLF & _
"3782692" & @CRLF & _
"5,943.6673093" & @CRLF & _
"307,688.8383952" & @CRLF & _
"Buy 6" & @CRLF & _
"0.00156" & @CRLF & _
"5976697" & @CRLF & _
"9,320.1865524" & @CRLF & _
"317,009.0249476" & @CRLF & _
"Buy 7" & @CRLF & _
"0.00155" & @CRLF & _
"22736745" & @CRLF & _
"35,230.3934790" & @CRLF & _
"352,239.4184266" & @CRLF & _
"Buy 8" & @CRLF & _
"0.00154" & @CRLF & _
"5347609" & @CRLF & _
"8,229.5362030" & @CRLF & _
"360,468.9546296" & @CRLF & _
"Buy 9" & @CRLF & _
"0.00153" & @CRLF & _
"3464283" & @CRLF & _
"5,302.3830325" & @CRLF & _
"365,771.3376621" & @CRLF & _
"Buy 10" & @CRLF & _
"0.00152" & @CRLF & _
"10692626" & @CRLF & _
"16,254.0610616" & @CRLF & _
"382,025.3987237" & @CRLF & _
"Buy 11" & @CRLF & _
"0.00151" & @CRLF & _
"17949230" & @CRLF & _
"27,091.3961166" & @CRLF & _
"409,116.7948403" & @CRLF & _
"Buy 12" & @CRLF & _
"0.00150" & @CRLF & _
"97614260" & @CRLF & _
"146,428.5035816" & @CRLF & _
"555,545.2984219" & @CRLF & _
"Buy 13" & @CRLF & _
"0.00149" & @CRLF & _
"2933085" & @CRLF & _
"4,367.6528087" & @CRLF & _
"559,912.9512306" & @CRLF & _
"Buy 14" & @CRLF & _
"0.00148" & @CRLF & _
"13280054" & @CRLF & _
"19,658.5822936" & @CRLF & _
"579,571.5335242" & @CRLF & _
"Buy 15" & @CRLF & _
"0.00147" & @CRLF & _
"5316367" & @CRLF & _
"7,816.6889988" & @CRLF & _
"587,388.2225230" & @CRLF & _
"Buy 16" & @CRLF & _
"0.00146" & @CRLF & _
"7788926" & @CRLF & _
"11,379.8559960" & @CRLF & _
"598,768.0785190" & @CRLF & _
"Buy 17" & @CRLF & _
"0.00145" & @CRLF & _
"19939233" & @CRLF & _
"28,951.3105372" & @CRLF & _
"627,719.3890562" & @CRLF & _
"Buy 18" & @CRLF & _
"0.00144" & @CRLF & _
"9125471" & @CRLF & _
"13,169.1109613" & @CRLF & _
"640,888.5000175" & @CRLF & _
"Buy 19" & @CRLF & _
"0.00143" & @CRLF & _
"15047419" & @CRLF & _
"21,528.2223294" & @CRLF & _
"662,416.7223469" & @CRLF & _
"Buy 20" & @CRLF & _
"0.00142" & @CRLF & _
"14442405" & @CRLF & _
"20,518.9900239" & @CRLF & _
"682,935.7123708" & @CRLF & _
"Buy 21" & @CRLF & _
"0.00141" & @CRLF & _
"7762618" & @CRLF & _
"10,954.5052212" & @CRLF & _
"693,890.2175920" & @CRLF & _
"Buy 22" & @CRLF & _
"0.00140" & @CRLF & _
"70712964" & @CRLF & _
"98,999.5705300" & @CRLF & _
"792,889.7881220" & @CRLF & _
"Buy 23" & @CRLF & _
"0.00139" & @CRLF & _
"18989941" & @CRLF & _
"26,429.5799747" & @CRLF & _
"819,319.3680967" & @CRLF & _
"Buy 24" & @CRLF & _
"0.00138" & @CRLF & _
"18402966" & @CRLF & _
"25,394.9657933" & @CRLF & _
"844,714.3338900" & @CRLF & _
"Buy 25" & @CRLF & _
"0.00137" & @CRLF & _
"6803275" & @CRLF & _
"9,332.4113272" & @CRLF & _
"854,046.7452172" & @CRLF & _
"Buy 26" & @CRLF & _
"0.00136" & @CRLF & _
"2160895" & @CRLF & _
"2,936.0797162" & @CRLF & _
"856,982.8249334" & @CRLF & _
"Buy 27" & @CRLF & _
"0.00135" & @CRLF & _
"32064580" & @CRLF & _
"43,285.0255160" & @CRLF & _
"900,267.8504494" & @CRLF & _
"Buy 28" & @CRLF & _
"0.00134" & @CRLF & _
"2160968" & @CRLF & _
"2,894.4177658" & @CRLF & _
"903,162.2682152" & @CRLF & _
"Buy 29" & @CRLF & _
"0.00133" & @CRLF & _
"16977334" & @CRLF & _
"22,584.7981210" & @CRLF & _
"925,747.0663362" & @CRLF & _
"Buy 30" & @CRLF & _
"0.00132" & @CRLF & _
"7917567" & @CRLF & _
"10,460.8080263" & @CRLF & _
"936,207.8743625" & @CRLF & _
"Buy 31" & @CRLF & _
"0.00131" & @CRLF & _
"12171178" & @CRLF & _
"15,930.0535734" & @CRLF & _
"952,137.9279359" & @CRLF & _
"Buy 32" & @CRLF & _
"0.00130" & @CRLF & _
"123592864" & @CRLF & _
"160,671.1593414" & @CRLF & _
"1,112,809.0872773" & @CRLF & _
"Buy 33" & @CRLF & _
"0.00129" & @CRLF & _
"42532906" & @CRLF & _
"54,830.3889145" & @CRLF & _
"1,167,639.4761918" & @CRLF & _
"Buy 34" & @CRLF & _
"0.00128" & @CRLF & _
"38688827" & @CRLF & _
"49,483.3175230" & @CRLF & _
"1,217,122.7937148" & @CRLF & _
"Buy 35" & @CRLF & _
"0.00127" & @CRLF & _
"1037481" & @CRLF & _
"1,318.9040123" & @CRLF & _
"1,218,441.6977271" & @CRLF & _
"Buy 36" & @CRLF & _
"0.00123" & @CRLF & _
"239488" & @CRLF & _
"293.6841344" & @CRLF & _
"1,218,735.3818615" & @CRLF & _
"Buy 37" & @CRLF & _
"0.00121" & @CRLF & _
"100000" & @CRLF & _
"121.3000000" & @CRLF & _
"1,218,856.6818615" & @CRLF & _
"Buy 38" & @CRLF & _
"0.00118" & @CRLF & _
"33819" & @CRLF & _
"40.0011132" & @CRLF & _
"1,218,896.6829747" & @CRLF & _
"Buy 39" & @CRLF & _
"0.00110" & @CRLF & _
"14330049" & @CRLF & _
"15,763.0539000" & @CRLF & _
"1,234,659.7368747" & @CRLF & _
"Buy 40" & @CRLF & _
"0.00098" & @CRLF & _
"507435" & @CRLF & _
"497.2863000" & @CRLF & _
"1,235,157.0231747" & @CRLF & _
"Buy 41" & @CRLF & _
"0.00081" & @CRLF & _
"16221" & @CRLF & _
"13.1665857" & @CRLF & _
"1,235,170.1897604" & @CRLF & _
"Buy 42" & @CRLF & _
"0.00060" & @CRLF & _
"5360817" & @CRLF & _
"3,216.4902000" & @CRLF & _
"1,238,386.6799604" & @CRLF & _
""
Local $sSubst = "Buy $1\t$2\t$3\t$4\t$5\t\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