#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(\x1B7)?(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~](\x1B[=>]\r?)*"
Local $sString = "show configuration" & @CRLF & _
"[?1h=" & @CRLF & _
"interfaces {[m" & @CRLF & _
" ethernet eth1 {[m" & @CRLF & _
" duplex auto[m" & @CRLF & _
" address 172.22.108.100/24[m" & @CRLF & _
" speed auto[m" & @CRLF & _
" smp_affinity auto[m" & @CRLF & _
" }[m" & @CRLF & _
" loopback lo {[m" & @CRLF & _
" }[m" & @CRLF & _
"}[m" & @CRLF & _
"system {[m" & @CRLF & _
" time-zone UTC[m" & @CRLF & _
" syslog {[m" & @CRLF & _
" }[m" & @CRLF & _
" config-management {[m" & @CRLF & _
" commit-revisions 20[m" & @CRLF & _
" }[m" & @CRLF & _
" host-name dm2500[m" & @CRLF & _
"[m" & @CRLF & _
"BLABLABLA" & @CRLF & _
"[K[?1l>admin@dm2500:~$ "
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