#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)(?<!#[^\n]*)\)(?!\))"
Local $sString = "TropicalFruitTOutput::TropicalFruitTOutput{)" & @CRLF & _
" : dad::CRunnable{)" & @CRLF & _
" , m_watermelon_out{)" & @CRLF & _
"#if MAX_FRUITS == (10)" & @CRLF & _
" , m_cherry_out{)" & @CRLF & _
"#endif" & @CRLF & _
"{" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"NationalFruitInput::NationalFruitInput{)" & @CRLF & _
" , m_banana_in{)" & @CRLF & _
" , m_dragronFruit{PAD_GetdragronFruitPAD_B(xcxcxc))" & @CRLF & _
"{" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"SpecialFruits::SpecialFruits{)" & @CRLF & _
" : AmazingClassType{)" & @CRLF & _
" , m_kiwi{)" & @CRLF & _
" , m_avocado{ // PRQA S 2961 # FALSEPOSITIVE QAC warning about uninitialized" & @CRLF & _
" // Hello world" & @CRLF & _
" // This is just a comment for" & @CRLF & _
" // testing purpose" & @CRLF & _
" m_apricotController.getApricotList())" & @CRLF & _
"{" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"using NewFruitsBase::NewFruitsBase;"
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