#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?sx)(?: ([^";\r\n]*) #1 value without quotes or" & @CRLF & _
" | \x20* ("(?:[^"]+|"")*") \x20* #2 value inside quotes" & @CRLF & _
")" & @CRLF & _
"(?: (;) #3 values delimiter or" & @CRLF & _
" | [\r\n]+ # rows delimiter" & @CRLF & _
")"
Local $sString = "501 ; 8300000000000 ; ";Автономный ;"";округ""" & @CRLF & _
" ""Ненецкий"";";test1" & @CRLF & _
" 751;8600800000000; " Автономный округ ""Ханты-Мансийский"", Район Советский" ;" & @CRLF & _
" 1755;8700300000000;Автономный округ Чукотский, Район Билибинский" & @CRLF & _
" 1725;7501900000000;Край Забайкальский, Район Петровск-Забайкальский" & @CRLF & _
"" & @CRLF & _
" ;;" & @CRLF & _
" 711;2302100000000;Край Краснодарский, Район Лабинский" & @CRLF & _
" 729;2401600000000;Край Красноярский, Район Иланский" & @CRLF & _
" 765;2700700000000;Край Хабаровский, Район Вяземский"
Local $sSubst = "\1\2\x01\3\x02"
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