#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?sm)^(SWEx-elmPCI-A-02\.lssh\.com)\s+(.*?)\s{2,}(\d+)\s+(.*?)\s{2,}([^\s]+)\s+(.*?)$"
Local $sString = "Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge" & @CRLF & _
" S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone," & @CRLF & _
" D - Remote, C - CVTA, M - Two-port Mac Relay" & @CRLF & _
"" & @CRLF & _
"Device ID Local Intrfce Holdtme Capability Platform Port ID" & @CRLF & _
"SWEx-elmPCI-A-02.lssh.com" & @CRLF & _
" Gig 2/0/1 137 R S I WS-C3750X Gig 1/0/1" & @CRLF & _
"SWEx-elmPCI-A-02.lssh.com" & @CRLF & _
" Gig 2/0/1 138 R S I WS-C3750X Gig 1/0/1" & @CRLF & _
"" & @CRLF & _
"SWEa-elmPCI-02 Gig 1/0/4 169 T AIR-LAP12 Gig 0" & @CRLF & _
"SWEa-elmPCI-01 Gig 1/0/9 170 T AIR-LAP11 Gig 0"
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