#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?i)(?x)" & @CRLF & _
"(\/\/[ \t]*)" & @CRLF & _
"(" & @CRLF & _
"\[(?:" & @CRLF & _
" (?:[-]?\d+(?:.\d)*)(?:[ \t]*:[ \t]*-?\d+(?:.\d)*){0,2} " & @CRLF & _
" |" & @CRLF & _
" (?:(?:[^:,]+:)?[^:,]+,)*(?:(?:[^:,]+:)?[^:,]+)" & @CRLF & _
")\]" & @CRLF & _
")" & @CRLF & _
"[ \t]*$\n?"
Local $sString = "" & @CRLF & _
"// Internal Diameter" & @CRLF & _
"innerWidth = 11.733333; // [40]" & @CRLF & _
"innerWidth = 11.733333; " & @CRLF & _
"// " & @CRLF & _
"[Invalid: thing]" & @CRLF & _
"height = 14;" & @CRLF & _
"wallWidth = 2;" & @CRLF & _
"" & @CRLF & _
"//#region [Options] Advanced" & @CRLF & _
"" & @CRLF & _
"/* [Advanced Options] */" & @CRLF & _
"enable_sloped_walls =true; // [10:20]" & @CRLF & _
"outerWidth_delta = 0.2;" & @CRLF & _
"" & @CRLF & _
"enable_sloped_walls_inner = true;" & @CRLF & _
"innerDelta = -1;" & @CRLF & _
"" & @CRLF & _
"rounded_top = true;" & @CRLF & _
"rounding_top = nothing * 5;" & @CRLF & _
"" & @CRLF & _
"rounded_bottom = false;" & @CRLF & _
"rounding_bottom = 1.5;"
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