#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(define[\s\S]*{)([\s\S\n\r]+?)(var\s+)([$\w_]+)(\s+)(.*)([,;])([\s\S\n\r]+?)(\w)"
Local $sString = "define(function(require, exports, module) {" & @CRLF & _
" var UIKit = require('uikit/uikit');" & @CRLF & _
" var ExtendUtil = require('helpers/extend.util');" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" var ConfirmModalView = UIKit.Modal2.extend({" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"define([" & @CRLF & _
" 'underscore'," & @CRLF & _
" 'marionette'," & @CRLF & _
"" & @CRLF & _
" '../libs/spf.helper'," & @CRLF & _
"" & @CRLF & _
" '../templates'," & @CRLF & _
"" & @CRLF & _
" 'uikit/injector'," & @CRLF & _
" 'uikit/component.collection.view'," & @CRLF & _
" 'uikit/grid'," & @CRLF & _
" 'uikit/table'," & @CRLF & _
" 'uikit/text'," & @CRLF & _
" 'uikit/button'" & @CRLF & _
" ], function(_, Mn," & @CRLF & _
" // data stuff" & @CRLF & _
" SPFHelper," & @CRLF & _
"" & @CRLF & _
" Templates," & @CRLF & _
" // view stuff" & @CRLF & _
" InjectorView, ComponentCollectionView, GridView, TableView, TextView, ButtonView) {"
Local $sSubst = "\1\2var _ = require('underscore'),\8 \4\5\6\7\8\9"
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