#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)(?P<hostname>Hostname:\s[^\n]+\n)" & @CRLF & _
"(?P<port>Port:\s[^\n]+\n+)" & @CRLF & _
"Misc\d:\s[\w\s]+\n+" & @CRLF & _
"(?P<management>Management\sAddress:" & @CRLF & _
"\s\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" & @CRLF & _
")" & @CRLF & _
"(?:(?!^----)(?!^Model:).|\n)*" & @CRLF & _
"(?P<model>Model:\s[^\n]*)?" & @CRLF & _
"" & @CRLF & _
""
Local $sString = "--------------------" & @CRLF & _
"Hostname: Stuff" & @CRLF & _
"Port: g0/1" & @CRLF & _
"" & @CRLF & _
"Misc1: lkbshjt7cy428" & @CRLF & _
"" & @CRLF & _
"Management Address: 127.0.0.1" & @CRLF & _
"" & @CRLF & _
"Misc2: aofigj46ujw" & @CRLF & _
"Misc3: 0193utjp9vu40-2" & @CRLF & _
"" & @CRLF & _
"--------------------" & @CRLF & _
"Hostname: And" & @CRLF & _
"Port: g0/2" & @CRLF & _
"" & @CRLF & _
"Misc1: g18u384gh89" & @CRLF & _
"" & @CRLF & _
"Management Address: 127.0.0.2" & @CRLF & _
"" & @CRLF & _
"Misc2: uhctpy9 24nmyhg894" & @CRLF & _
"" & @CRLF & _
"--------------------" & @CRLF & _
"Hostname: Junk" & @CRLF & _
"Port: g0/3" & @CRLF & _
"" & @CRLF & _
"Misc1: oit 2updhtg90234" & @CRLF & _
"" & @CRLF & _
"Management Address: 127.0.0.3" & @CRLF & _
"" & @CRLF & _
"Misc2: aohjq43p98u90u" & @CRLF & _
"Misc3: 92 ycn09874gy8o" & @CRLF & _
"Model: Thing" & @CRLF & _
"Misc4: 07vk378k3" & @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