#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)address\s*\d+\s*range\s(?<srcIp1>\S+)\s*(?<srcIp2>\S+)"
Local $sString = "[USG6300E]display current-configuration" & @CRLF & _
"#" & @CRLF & _
"ip service-set TCP-TSGZ type object 514" & @CRLF & _
" service 0 protocol tcp source-port 8801 to 8804 destination-port 0 to 65535" & @CRLF & _
" service 1 protocol tcp source-port 12404 destination-port 0 to 65535" & @CRLF & _
"#" & @CRLF & _
"ip service-set GWDK type object 515" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 135" & @CRLF & _
" service 1 protocol tcp source-port 0 to 65535 destination-port 137 to 139" & @CRLF & _
" service 2 protocol tcp source-port 0 to 65535 destination-port 445" & @CRLF & _
" service 3 protocol tcp source-port 0 to 65535 destination-port 3389" & @CRLF & _
" service 4 protocol udp source-port 0 to 65535 destination-port 135" & @CRLF & _
" service 5 protocol udp source-port 0 to 65535 destination-port 137 to 139" & @CRLF & _
" service 6 protocol udp source-port 0 to 65535 destination-port 445" & @CRLF & _
" service 7 protocol udp source-port 0 to 65535 destination-port 3389" & @CRLF & _
"#" & @CRLF & _
"ip service-set FXTCP2403 type object 516" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 2403" & @CRLF & _
"#" & @CRLF & _
"ip service-set FXTCP2404 type object 517" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 2404" & @CRLF & _
"#" & @CRLF & _
"ip service-set FXTCPTSGZ type object 518" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 8801 to 8804" & @CRLF & _
" service 1 protocol tcp source-port 0 to 65535 destination-port 12404" & @CRLF & _
"#" & @CRLF & _
"ip service-set TCP5149 type object 519" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 5149 to 5150" & @CRLF & _
"#" & @CRLF & _
"ip service-set FXTCP5149 type object 520" & @CRLF & _
" service 0 protocol tcp source-port 5149 to 5150 destination-port 0 to 65535" & @CRLF & _
"#" & @CRLF & _
"ip service-set syslo type object 521" & @CRLF & _
" service 0 protocol udp source-port 0 to 65535 destination-port 162" & @CRLF & _
" service 1 protocol udp source-port 0 to 65535 destination-port 514" & @CRLF & _
"#" & @CRLF & _
"ip service-set UDPCJ type object 522" & @CRLF & _
" service 0 protocol udp source-port 0 to 65535 destination-port 161" & @CRLF & _
"#" & @CRLF & _
"ip service-set TCP102 type object 523" & @CRLF & _
" service 0 protocol tcp source-port 0 to 65535 destination-port 102" & @CRLF & _
" service 1 protocol tcp source-port 102 destination-port 0 to 65535" & @CRLF & _
"#" & @CRLF & _
"ip service-set serviceg1 type group 0" & @CRLF & _
" service 0 service-set ntp" & @CRLF & _
"#" & @CRLF & _
"ip service-set serviceg2 type group 1" & @CRLF & _
" service 0 service-set serviceg1" & @CRLF & _
" service 1 service-set FXTCPTSGZ" & @CRLF & _
"#" & @CRLF & _
"" & @CRLF & _
"#" & @CRLF & _
"ip address-set TSGZZhu type object" & @CRLF & _
" address 0 range 10.78.48.112 10.78.48.118" & @CRLF & _
"#" & @CRLF & _
"ip address-set TSGZzi type object" & @CRLF & _
" address 0 10.82.186.11 mask 32" & @CRLF & _
"#" & @CRLF & _
"ip address-set JLzhu type object" & @CRLF & _
" address 0 range 10.78.44.1 10.78.44.15" & @CRLF & _
"#" & @CRLF & _
"ip address-set JLzi type object" & @CRLF & _
" address 0 range 10.82.186.5 10.82.186.6" & @CRLF & _
"#" & @CRLF & _
"ip address-set BXzhu type object" & @CRLF & _
" address 0 range 10.78.48.197 10.78.48.200" & @CRLF & _
"#" & @CRLF & _
"ip address-set BXzi type object" & @CRLF & _
" address 0 range 10.82.186.9 10.82.186.10" & @CRLF & _
"#" & @CRLF & _
"ip address-set DICPzhu type object" & @CRLF & _
" address 0 range 10.78.48.39 10.78.48.40" & @CRLF & _
"#" & @CRLF & _
"ip address-set DICPzi type object" & @CRLF & _
" address 0 10.82.186.4 mask 32" & @CRLF & _
"#" & @CRLF & _
"ip address-set erqu type object" & @CRLF & _
" address 0 10.85.186.0 mask 27" & @CRLF & _
"#" & @CRLF & _
"ip address-set addressg1 type group" & @CRLF & _
" address 0 address-set erqu" & @CRLF & _
"#" & @CRLF & _
"ip address-set addressg2 type group" & @CRLF & _
" address 0 address-set addressg1" & @CRLF & _
" address 1 address-set DICPzi" & @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