#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)(?ms)(?<Connection>^\d+)\s+IKE\sPeer[\s:]+(?<IKEPeer>[\d\.]+\s\([\w ]+\)).+?Type[\s:]+(?<Type>[\w]+)\s+Role[\s:]+(?<Role>\w+).+?Rekey[\s:]+(?<Rekey>\w+)\s+State[\s:]+(?<State>\w+).+?Encrypt[\s:]+(?<Encrypt>[\w-]+)\s+Hash[\s:]+(?<Hash>\w+).+?Auth[\s:]+(?<Auth>\w+)\s+Lifetime[\s:]+(?<Lifetime>\d+).+?Lifetime\sRemaining[\s:]+(?<LifetimeRemaining>\d+)"
Local $sString = "1 IKE Peer: 192.168.8.188 (PHX2)" & @CRLF & _
"Type : L2L Role : initiator " & @CRLF & _
"Rekey : no State : MM_ACTIVE " & @CRLF & _
"Encrypt : 3des Hash : SHA " & @CRLF & _
"Auth : preshared Lifetime: 86400" & @CRLF & _
"Lifetime Remaining: 52140" & @CRLF & _
"2 IKE Peer: 192.168.8.189 (Worcester)" & @CRLF & _
"Type : L2L Role : initiator " & @CRLF & _
"Rekey : no State : MM_ACTIVE " & @CRLF & _
"Encrypt : aes-256 Hash : SHA " & @CRLF & _
"Auth : preshared Lifetime: 28800" & @CRLF & _
"Lifetime Remaining: 5929" & @CRLF & _
"3 IKE Peer: 192.168.8.190 (Fresno)" & @CRLF & _
"Type : L2L Role : initiator " & @CRLF & _
"Rekey : no State : MM_ACTIVE " & @CRLF & _
"Encrypt : aes-256 Hash : SHA " & @CRLF & _
"Auth : preshared Lifetime: 28800" & @CRLF & _
"Lifetime Remaining: 6564" & @CRLF & _
"4 IKE Peer: 192.168.8.191 (San Leandro)" & @CRLF & _
"Type : L2L Role : initiator " & @CRLF & _
"Rekey : no State : MM_ACTIVE " & @CRLF & _
"Encrypt : 3des Hash : SHA " & @CRLF & _
"Auth : preshared Lifetime: 86400" & @CRLF & _
"Lifetime Remaining: 71608"
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