#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^wlan (\S+).*(?:\r?\n(?!wlan|.*? dot1 authent ).*)*\r?\n.*? dot1 authent (.+).*(?:\r?\n(?!wlan).*)*"
Local $sString = "wlan SSID1 SSID1" & @CRLF & _
" test2" & @CRLF & _
" test1" & @CRLF & _
" dot1 authent TESTTEST1" & @CRLF & _
" test3" & @CRLF & _
"wlan SSID2 SSID2" & @CRLF & _
" test21" & @CRLF & _
" test11" & @CRLF & _
" test31" & @CRLF & _
"wlan SSID3 SSID3" & @CRLF & _
" test22" & @CRLF & _
" test12" & @CRLF & _
" dot1 authent TESTTEST3" & @CRLF & _
" test32" & @CRLF & _
"wlan SSID4 SSID4" & @CRLF & _
" test23" & @CRLF & _
" test13" & @CRLF & _
" dot1 authent TESTTEST4" & @CRLF & _
" test33"
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