#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(Source_addresses:(?:.|\n)*?Applications:.*\n)"
Local $sString = "Policy name: example-3 (lf-csd) (LINE 29907)" & @CRLF & _
"" & @CRLF & _
" Description: CHANGE00001" & @CRLF & _
" Destination_addresses (8):" & @CRLF & _
" 10.0.0.1/32 ( 10.0.0.1-lk-3r53) ( 3125)" & @CRLF & _
" 10.0.0.8/32 ( 10.0.0.8-test13) ( 3157)" & @CRLF & _
" 10.0.0.3/32 ( 10.0.0.3-gdgsd-cd) ( 2806)" & @CRLF & _
" 10.0.0.9/32 ( 10.0.0.9-fd-fdsb) ( 3123)" & @CRLF & _
"" & @CRLF & _
" Destination_address_sets (0):" & @CRLF & _
" Source_addresses:" & @CRLF & _
" 10.0.0.7/32 ( 10.0.0.7-IR) ( 5989)" & @CRLF & _
"" & @CRLF & _
" Applications: tcp3389" & @CRLF & _
" Then: permit" & @CRLF & _
"" & @CRLF & _
"Policy name: example-4 (lfs-csd) (LINE 29907)" & @CRLF & _
"" & @CRLF & _
" Description: CHANGE00002" & @CRLF & _
" Destination_addresses (3):" & @CRLF & _
" 10.0.0.6/32 ( 10.0.0.1-lk-3r53) ( 3125)" & @CRLF & _
" 10.0.0.2/32 ( 10.0.0.8-test13) ( 3157)" & @CRLF & _
" 10.0.0.53/32 ( 10.0.0.3-gdgsd-cd) ( 2806)" & @CRLF & _
" 10.0.0.94/32 ( 10.0.0.9-fd-fdsb) ( 3123)" & @CRLF & _
"" & @CRLF & _
" Destination_address_sets (0):" & @CRLF & _
" Source_addresses:" & @CRLF & _
" 10.0.0.53/32 ( 10.0.0.52-IR) ( 5989)" & @CRLF & _
"" & @CRLF & _
" Applications: tcp53" & @CRLF & _
" Then: permit"
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