#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^file *"?([^" ]*)"[\s\S]*?((?:{[\s\S]*?)*?}[\s\S]})"
Local $sString = "#############################################################################" & @CRLF & _
"# DB substitution file generated by http://github.com/epics-containers/ibek #" & @CRLF & _
"#############################################################################" & @CRLF & _
"" & @CRLF & _
"file "$(IOCSTATS)/db/iocAdminSoft.db" {" & @CRLF & _
"pattern " & @CRLF & _
" { "IOC" }" & @CRLF & _
" { "BL01T-EA-TST-02" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "$(IOCSTATS)/db/iocAdminScanMon.db" {" & @CRLF & _
"pattern " & @CRLF & _
" { "IOC" }" & @CRLF & _
" { "BL01T-EA-TST-02" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "$(ADSIMDETECTOR)/db/simDetector.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "P", "R", "PORT", "TIMEOUT", "ADDR" }" & @CRLF & _
" { "BL01T-EA-TST-02", ":DET:", "DET.DET", "1", "0" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "$(ADCORE)/db/NDPva.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "NDARRAY_PORT", "ADDR", "SCANRATE", "NDARRAY_ADDR", "ENABLED", "P", "R", "TIMEOUT", "PORT" }" & @CRLF & _
" { "DET.DET", "0", "I/O Intr", "0", "0", "BL01T-EA-TST-02", ":PVA:", "1", "DET.PVA" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "$(ADCORE)/db/NDStdArrays.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "NDARRAY_PORT", "FTVL", "ADDR", "SCANRATE", "NELEMENTS", "NDARRAY_ADDR", "ENABLED", "P", "R", "TIMEOUT", "TYPE", "PORT" }" & @CRLF & _
" { "DET.DET", "CHAR", "0", "I/O Intr", "1048576", "0", "0", "BL01T-EA-TST-02", ":ARR:", "1", "Int8", "DET.ARR" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "simDetector.pvi.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "P", "R" }" & @CRLF & _
" { "BL01T-EA-TST-02", ":DET:" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "NDPluginPva.pvi.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "P", "R" }" & @CRLF & _
" { "BL01T-EA-TST-02", ":PVA:" }" & @CRLF & _
"}" & @CRLF & _
"" & @CRLF & _
"file "NDPluginStdArrays.pvi.template" {" & @CRLF & _
"pattern " & @CRLF & _
" { "P", "R" }" & @CRLF & _
" { "BL01T-EA-TST-02", ":ARR:" }" & @CRLF & _
"}" & @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