#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mU)function(.|\n)*{(.|\n)*if(.|\n)*function "
Local $sString = " onRenderComplete: function () {" & @CRLF & _
" pageData.orderingAll = viewModel.tabAllGrid.getOrdering();" & @CRLF & _
"" & @CRLF & _
" if (app.session.features.openNotesAndMessagesFromList_VEA14870) {" & @CRLF & _
" $('#tabAllGrid .connectedMessageIcon').on('click', function (e) {" & @CRLF & _
"" & @CRLF & _
" var $messages = $(e.target)," & @CRLF & _
" $row = $messages.parents('.gridRow')," & @CRLF & _
" rowId = $row.data('row')," & @CRLF & _
" rowData = $('#tabAllGrid').vismaGrid('getRowData', rowId);" & @CRLF & _
" postItMessageModal(rowData);" & @CRLF & _
" });" & @CRLF & _
"" & @CRLF & _
" function postItMessageModal(data) {" & @CRLF & _
" var documentType = null;" & @CRLF & _
" var documentId = null;" & @CRLF & _
" var urls = data.invoiceUrl.split('/');" & @CRLF & _
" if (urls.length > 3 && urls[3]) {" & @CRLF & _
" documentType = urls[2];" & @CRLF & _
" var guidRegex = /^[{]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[}]?$/;" & @CRLF & _
" if (urls[3].match(guidRegex)) {" & @CRLF & _
" documentId = urls[3];" & @CRLF & _
" } else {" & @CRLF & _
" documentId = urls[4];" & @CRLF & _
" }" & @CRLF & _
" }" & @CRLF & _
" app.shell.viewModel.commentViewModel.getMessagesForGivenDocument(documentType, documentId, false, true);" & @CRLF & _
" };" & @CRLF & _
" }" & @CRLF & _
" }," & @CRLF & _
" initialSelected: initialSelectedAll" & @CRLF & _
" };"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
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