#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?:^(?:[^|\r\n]*\|){10}[^|\r\n]*\K\||(?!^)\G[^|\r\n]*\K\|)(?=.*(?:\|[^|\r\n]*){2}$)"
Local $sString = "A1|A2|A3|A4|A5|A6|A7|A8|A9|A10|A11|A12|A13|A14|A15|A16|AA" & @CRLF & _
"B1|B2|B3|B4|B5|B6|B7|B8|B9|B10|B11|B12|B13|B14|B15|AA" & @CRLF & _
"C1|C2|C3|C4|C5|C6|C7|C8|C9|C10|C11|C12|C13|C14|AA" & @CRLF & _
"D1|D2|D3|D4|D5|D6|D7|D8|D9|D10|D11|D12|D13|AA" & @CRLF & _
"E1|E2|E3|E4|E5|E6|E7|E8|E9|E10|E11|E12|AA" & @CRLF & _
""
Local $sSubst = " "
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