#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?m)^line\scon.*(?:\n .+)*"
Local $sString = "!" & @CRLF & _
"line con 0" & @CRLF & _
" session-timeout 5 " & @CRLF & _
" exec-timeout 5 0" & @CRLF & _
" password 7 1239211A43054F0202D1D" & @CRLF & _
" transport output none" & @CRLF & _
"line 2" & @CRLF & _
" no activation-character" & @CRLF & _
" no exec" & @CRLF & _
" transport preferred none" & @CRLF & _
" transport output pad telnet rlogin lapb-ta mop udptn v120 ssh" & @CRLF & _
" stopbits 1" & @CRLF & _
"line vty 0 4" & @CRLF & _
" session-timeout 5 " & @CRLF & _
" access-class 125 in" & @CRLF & _
" exec-timeout 5 0" & @CRLF & _
" length 0" & @CRLF & _
" transport input ssh" & @CRLF & _
" transport output none"
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