#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(\s?,\s?)(?=[^\(]*\))|(\s?,\s?)(?=(?:[^\(]*\([^\(]*?\))*\))"
Local $sString = "SELECT 'column1' AS "Column 1" , " & @CRLF & _
" 'column2' AS "Column 2" , " & @CRLF & _
" 'column3' AS "Column 3", " & @CRLF & _
"SUM(Column_1, Column_2) , 'column5' AS "Column 5" ," & @CRLF & _
"CONCAT("str1","str2","str3") , " & @CRLF & _
"ADD(len(str1),avg(column_1),sum(column_1,column_2,column_3)) "
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