#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(\|)\R(?!\|[ \t]+\d+[ \t]+\|)"
Local $sString = "| 1020941333 | 569|SP |500000343 | 9|18.05.2011|15:27:00|18.05.2011|" & @CRLF & _
"18.05.2011|Y-0444871-ENCR | 1,93 |BRL |8000800000 |" & @CRLF & _
"Juros, Comissões e T | | |" & @CRLF & _
" | | | |" & @CRLF & _
" |CLB082902 | | | |COEL |COEL |" & @CRLF & _
"Y-0444871 |" & @CRLF & _
"| 1020941586 | 43|SP |500000344 |43|18.05.2011|15:41:43|18.05.2011|" & @CRLF & _
"18.05.2011|B-0447039-ENCR | 9,02 |BRL |8000800000 |" & @CRLF & _
"Juros, Comissões e T | | |" & @CRLF & _
" | | | |" & @CRLF & _
" |CLB082902 | | | |COEL |COEL |" & @CRLF & _
"B-0447039 |"
Local $sSubst = "$1"
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