#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sm)^([^\n]*TenGigE[^\n]*)(?:(?!TenGigE|carrier-delay).)*([^\n]*carrier-delay[^\n]*)"
Local $sString = "interface TenGigE0/0/0/8" & @CRLF & _
" bundle id 221 mode active" & @CRLF & _
" lacp period short" & @CRLF & _
" lacp period short receive 100" & @CRLF & _
" lacp period short transmit 100" & @CRLF & _
" carrier-delay up 100 down 100" & @CRLF & _
"" & @CRLF & _
"interface TenGigE0/0/0/7" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"shutdown" & @CRLF & _
"" & @CRLF & _
"!" & @CRLF & _
"" & @CRLF & _
"interface TenGigE0/0/0/8" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" bundle id 221 mode active" & @CRLF & _
"" & @CRLF & _
" lacp period short" & @CRLF & _
"" & @CRLF & _
" lacp period short receive 100" & @CRLF & _
"" & @CRLF & _
" lacp period short transmit 100" & @CRLF & _
"" & @CRLF & _
" carrier-delay up 100 down 100" & @CRLF & _
"" & @CRLF & _
" load-interval 30" & @CRLF & _
"" & @CRLF & _
" frequency synchronization" & @CRLF & _
"" & @CRLF & _
" !" & @CRLF & _
"" & @CRLF & _
" transceiver permit pid all" & @CRLF & _
"" & @CRLF & _
"!" & @CRLF & _
"" & @CRLF & _
"interface TenGigE0/0/0/9" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" mtu 9216" & @CRLF & _
"" & @CRLF & _
" frequency synchronization" & @CRLF & _
"" & @CRLF & _
" !" & @CRLF & _
"" & @CRLF & _
" transceiver permit pid all" & @CRLF & _
"" & @CRLF & _
"!" & @CRLF & _
"" & @CRLF & _
"interface TenGigE0/0/0/10" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
" bundle id 237 mode active" & @CRLF & _
"" & @CRLF & _
" lacp period short" & @CRLF & _
"" & @CRLF & _
" lacp period short receive 100" & @CRLF & _
"" & @CRLF & _
" lacp period short transmit 100" & @CRLF & _
"" & @CRLF & _
" carrier-delay up 120000 down 150" & @CRLF & _
"" & @CRLF & _
" load-interval 30" & @CRLF & _
"" & @CRLF & _
" frequency synchronization"
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