#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?is)Public(?: ReadOnly)? Property (?<prop>.*?)\(\) As [a-zA-Z]*(?: Implements )?.*? End Property"
Local $sString = "Imports System.Windows.Forms" & @CRLF & _
"Imports System.Drawing" & @CRLF & _
"Imports CapReportLib" & @CRLF & _
"Imports ReportControls.Database" & @CRLF & _
"Imports System.Threading" & @CRLF & _
"Imports System.ComponentModel" & @CRLF & _
"" & @CRLF & _
"Public Class Report : Implements IReport" & @CRLF & _
"#Region "Fields"" & @CRLF & _
" Friend MyReportRunTime As TimeSpan" & @CRLF & _
" Friend MyLastException As New Exception("No Errors")" & @CRLF & _
" Friend RepParams As New ReportParameters()" & @CRLF & _
" Friend Shared DBA As ReportControls.Database.DataAccess" & @CRLF & _
" Private lastResult As New ReportResult(False, New TimeSpan, String.Empty)" & @CRLF & _
" Private Shared delRunReport As IReport.Execute = Nothing" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" Private repSync As ISynchronizeInvoke" & @CRLF & _
" Private repThread As Thread" & @CRLF & _
" Private repHandler As IReport.ReportHandler" & @CRLF & _
"" & @CRLF & _
" Private repParamsSync As ISynchronizeInvoke" & @CRLF & _
" Private threadIsRunning As Boolean = False" & @CRLF & _
" Private Delegate Sub EnableCsvHandler(ByVal enable As Boolean, ByVal value As String)" & @CRLF & _
" Private enableCsv As EnableCsvHandler" & @CRLF & _
" Private csvData As String = String.Empty" & @CRLF & _
"" & @CRLF & _
" Private startDate As Date = Now" & @CRLF & _
" Private endDate As Date = Now" & @CRLF & _
" Private origin As ReportControls.Types.OriginItem" & @CRLF & _
"#End Region" & @CRLF & _
"" & @CRLF & _
"#Region "Threading"" & @CRLF & _
" Private Sub RunReportThread()" & @CRLF & _
" threadIsRunning = True" & @CRLF & _
" Dim rs = ExecuteReport()" & @CRLF & _
" If repThread.ThreadState <> ThreadState.AbortRequested Then" & @CRLF & _
" repSync.Invoke(repHandler, New Object() {rs})" & @CRLF & _
" repParamsSync.Invoke(enableCsv, New Object() {True, csvData})" & @CRLF & _
" End If" & @CRLF & _
" threadIsRunning = False" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub ExecuteReportThread() Implements IReport.ExecuteReportThread" & @CRLF & _
" repParamsSync = RepParams" & @CRLF & _
" enableCsv = AddressOf RepParams.EnableCsvExport" & @CRLF & _
" repThread = New Thread(AddressOf RunReportThread)" & @CRLF & _
" repThread.Start()" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetReportHandler(ByVal rh As IReport.ReportHandler) Implements IReport.SetReportHandler" & @CRLF & _
" repHandler = rh" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub StopReport() Implements IReport.StopReport" & @CRLF & _
" If repThread Is Nothing Then Return" & @CRLF & _
"" & @CRLF & _
" If repThread.IsAlive Then" & @CRLF & _
" repThread.Abort()" & @CRLF & _
" End If" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetSyncInvoke(ByVal syn As ISynchronizeInvoke) Implements IReport.SetSyncInvoke" & @CRLF & _
" repSync = syn" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetReportHandler(ByVal rh As IReport.ReportHandler, ByVal syn As ISynchronizeInvoke) _" & @CRLF & _
" Implements IReport.SetReportHandler" & @CRLF & _
" repSync = syn" & @CRLF & _
" repHandler = rh" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
"#End Region" & @CRLF & _
"" & @CRLF & _
"#Region "Initialize"" & @CRLF & _
" Public Sub SetOutPut(ByVal pnlControls As Panel) Implements IReport.SetOutPut" & @CRLF & _
" RepParams.Parent = pnlControls" & @CRLF & _
" RepParams.Dock = DockStyle.Fill" & @CRLF & _
" RepParams.Show()" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetReportDataAccess(ByVal connectionString As String) Implements CapReportLib.IReport.SetReportConnectionString" & @CRLF & _
" SetDataAccess(New ReportControls.Database.DataAccess(connectionString))" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetDataAccess(ByVal db As DataAccess)" & @CRLF & _
" DBA = db" & @CRLF & _
"" & @CRLF & _
" SetOrigins()" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Private Sub SetOrigins()" & @CRLF & _
" RepParams.OriginSelector.SetConnectionString(DBA.ConnectionString)" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub SetReportExecute(ByVal exc As IReport.Execute) Implements IReport.SetReportExecute" & @CRLF & _
" delRunReport = exc" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub Dispose() Implements IReport.Dispose" & @CRLF & _
" DBA.Dispose()" & @CRLF & _
" RepParams.Dispose()" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
"#End Region" & @CRLF & _
"" & @CRLF & _
"#Region "Run Report"" & @CRLF & _
" Public Function ExecuteReport() As ReportResult Implements IReport.ExecuteReport" & @CRLF & _
" RepParams.CsvButton1.EnableCsvExport(False, String.Empty)" & @CRLF & _
" Dim success As Boolean = True" & @CRLF & _
" Dim startRun = Now" & @CRLF & _
" Dim repData As String = String.Empty" & @CRLF & _
" Try" & @CRLF & _
" If HasValidParametersSelected Then" & @CRLF & _
" " & @CRLF & _
" Dim rep As New DocsStoredReport(startDate, endDate)" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" repData = rep.Execute(origin, RepParams.ChkRunOriginal.Checked)" & @CRLF & _
"" & @CRLF & _
" csvData = rep.CsvOutput" & @CRLF & _
" If Not threadIsRunning Then" & @CRLF & _
" RepParams.CsvButton1.EnableCsvExport(True, rep.CsvOutput)" & @CRLF & _
" End If" & @CRLF & _
"" & @CRLF & _
" End If" & @CRLF & _
" Catch ex As Exception" & @CRLF & _
" success = False" & @CRLF & _
" MyLastException = ex" & @CRLF & _
" End Try" & @CRLF & _
" Dim endRun = Now" & @CRLF & _
" lastResult = New ReportResult(success, endRun - startRun, repData)" & @CRLF & _
" Return lastResult" & @CRLF & _
" End Function" & @CRLF & _
"" & @CRLF & _
" Friend Shared Sub RunReport()" & @CRLF & _
" If delRunReport Is Nothing Then Return" & @CRLF & _
" delRunReport.Invoke()" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
"#End Region" & @CRLF & _
"" & @CRLF & _
"#Region "Format Output"" & @CRLF & _
" Public Sub FormatText(ByRef disp As RichTextBox) Implements IReport.FormatText" & @CRLF & _
" Dim iFont As New Font("Courier New", 12, FontStyle.Regular, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectAll()" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
" 'disp.SelectionAlignment = HorizontalAlignment.Center" & @CRLF & _
"" & @CRLF & _
" If disp.Find(DocsStoredReport.Header) = -1 Then Return" & @CRLF & _
"" & @CRLF & _
" disp.SelectionStart = disp.Find(DocsStoredReport.Header)" & @CRLF & _
" disp.SelectionLength = DocsStoredReport.Header.Length" & @CRLF & _
" iFont = New Font("Courier New", 18, FontStyle.Bold, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
" 'disp.SelectionAlignment = HorizontalAlignment.Center" & @CRLF & _
"" & @CRLF & _
" disp.SelectionStart = disp.Find(DocsStoredReport.DateRange)" & @CRLF & _
" disp.SelectionLength = DocsStoredReport.DateRange.Length" & @CRLF & _
" iFont = New Font("Courier New", 18, FontStyle.Bold, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
" 'disp.SelectionAlignment = HorizontalAlignment.Center" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" disp.SelectionStart = disp.Find(DocsStoredReport.SubHeader)" & @CRLF & _
" disp.SelectionLength = DocsStoredReport.SubHeader.Length" & @CRLF & _
" iFont = New Font("Courier New", 12, FontStyle.Bold Xor FontStyle.Underline, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
" 'disp.SelectionAlignment = HorizontalAlignment.Center" & @CRLF & _
"" & @CRLF & _
" disp.SelectionStart = disp.Find("Export Files")" & @CRLF & _
" disp.SelectionLength = "Export Files".Length" & @CRLF & _
" iFont = New Font("courier new", 12, FontStyle.Bold, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" disp.SelectionStart = disp.Find(ExportFile.HeaderRow(False))" & @CRLF & _
" disp.SelectionLength = ExportFile.HeaderRow(False).Length" & @CRLF & _
" iFont = New Font("Courier New", 12, FontStyle.Bold Xor FontStyle.Underline, GraphicsUnit.Pixel)" & @CRLF & _
" disp.SelectionFont = iFont" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub FormatText(ByRef lbl As Label) Implements IReport.FormatText" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public Sub FormatTreeView(ByRef trv As TreeView) Implements IReport.FormatTreeView" & @CRLF & _
" End Sub" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property DisplayXmlRootNode() As Boolean Implements IReport.DisplayXmlRootNode" & @CRLF & _
" Get" & @CRLF & _
" Return True" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property AttributeDisplay() As XmlAttributeDisplay Implements IReport.AttributeDisplay" & @CRLF & _
" Get" & @CRLF & _
" Return XmlAttributeDisplay.None" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property AttributeDelimiter() As String Implements IReport.AttributeDelimiter" & @CRLF & _
" Get" & @CRLF & _
" Return " | "" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
"#End Region" & @CRLF & _
"" & @CRLF & _
"#Region "Information"" & @CRLF & _
" Public ReadOnly Property ReportName() As String Implements IReport.ReportName" & @CRLF & _
" Get" & @CRLF & _
" Return "Documents Stored"" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property ReportDescription() As String Implements IReport.ReportDescription" & @CRLF & _
" Get" & @CRLF & _
" Return "Totals for the documents stored"" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property ReportExportType() As ExportType Implements IReport.ReportExportType" & @CRLF & _
" Get" & @CRLF & _
" Return ExportType.Text" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property HasValidParametersSelected() As Boolean Implements IReport.HasValidParametersSelected" & @CRLF & _
" Get" & @CRLF & _
" endDate = RepParams.DateRange.GetEndDate" & @CRLF & _
" startDate = RepParams.DateRange.GetStartDate" & @CRLF & _
" origin = RepParams.OriginSelector.SelectedValue" & @CRLF & _
" Return RepParams.ValidParameters" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property ReportHeader() As String Implements IReport.ReportHeader" & @CRLF & _
" Get" & @CRLF & _
" Return String.Empty" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public Property LastError() As Exception Implements IReport.LastError" & @CRLF & _
" Get" & @CRLF & _
" Return MyLastException" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property ReportResults() As ReportResult Implements IReport.ReportResults" & @CRLF & _
" Get" & @CRLF & _
" Return lastResult" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property AllowExport() As Boolean Implements IReport.AllowExport" & @CRLF & _
" Get" & @CRLF & _
" Return True" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public ReadOnly Property Parameters() As String Implements IReport.Parameters" & @CRLF & _
" Get" & @CRLF & _
" Dim params As Object() = New Object() _" & @CRLF & _
" {vbNewLine, RepParams.DateRange.GetStartDate.ToShortDateString, _" & @CRLF & _
" RepParams.DateRange.GetEndDate.ToShortDateString}" & @CRLF & _
" Return String.Format("StartDate: {1}{0}EndDate: {2}{0}", params)" & @CRLF & _
" End Get" & @CRLF & _
" End Property" & @CRLF & _
"" & @CRLF & _
" Public Overloads Function ToString() As String Implements IReport.ToString" & @CRLF & _
" Return ReportName" & @CRLF & _
" End Function" & @CRLF & _
"" & @CRLF & _
"#End Region" & @CRLF & _
"End Class" & @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