#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)\bSOURCE#.*\s*^\[1](.*\s*^(?!\[\d+]).*\bPN[QR](?:\n(?!\[\d+]).*)*(?:\n\[\d+].*)*)"
Local $sString = "**** SOURCE#24 ****" & @CRLF & _
"" & @CRLF & _
"[1] Source Location [Local/Remote] : Remote" & @CRLF & _
"" & @CRLF & _
" Remote Host Name : PNQ" & @CRLF & _
" User Name : foo" & @CRLF & _
"" & @CRLF & _
"[2] Source directory : HDPGWRF" & @CRLF & _
"[3] Directory poll interval : 30" & @CRLF & _
"[4] File name format : ACR_FILEFORMAT" & @CRLF & _
"[5] Delete files from source : y" & @CRLF & _
"" & @CRLF & _
"**** SOURCE#25 ****" & @CRLF & _
"" & @CRLF & _
"[1] Source Location [Local/Remote] : Remote" & @CRLF & _
"" & @CRLF & _
" Remote Host Name : PNR" & @CRLF & _
" User Name : foo" & @CRLF & _
"" & @CRLF & _
"[2] Source directory : HDPGWRF" & @CRLF & _
"[3] Directory poll interval : 30" & @CRLF & _
"[4] File name format : ACR_FILEFORMAT" & @CRLF & _
"[5] Delete files from source : y" & @CRLF & _
"" & @CRLF & _
"**** SOURCE#26 ****" & @CRLF & _
"etc....."
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