#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)ip dhcp excluded-address ([\d\.]*)($| ([\d\.]*)$)"
Local $sString = "ip dhcp excluded-address 10.10.8.1 10.10.8.100" & @CRLF & _
"ip dhcp excluded-address 10.8.8.1 10.8.9.0" & @CRLF & _
"ip dhcp excluded-address 192.168.0.1 192.168.0.10" & @CRLF & _
"ip dhcp excluded-address 10.10.9.12" & @CRLF & _
"ip dhcp excluded-address 10.10.9.14" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Pool1" & @CRLF & _
" network 10.10.8.0 255.255.248.0" & @CRLF & _
" update dns both override" & @CRLF & _
" dns-server 10.10.1.10 10.10.1.11 " & @CRLF & _
" default-router 10.10.8.1 " & @CRLF & _
" lease 8" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Pool2" & @CRLF & _
" network 10.8.8.0 255.255.248.0" & @CRLF & _
" update dns both override" & @CRLF & _
" default-router 10.8.8.1 " & @CRLF & _
" dns-server 10.10.1.10 10.10.1.11 " & @CRLF & _
" lease 8" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Pool3" & @CRLF & _
" network 192.168.0.0 255.255.255.0" & @CRLF & _
" update dns both override" & @CRLF & _
" dns-server 10.10.1.10 10.10.1.11 " & @CRLF & _
" default-router 192.168.0.1 " & @CRLF & _
" lease 8" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Device1" & @CRLF & _
" host 10.10.10.84 255.255.248.0" & @CRLF & _
" client-identifier 0100.24ee.065d.3e" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Device2" & @CRLF & _
" host 10.10.10.115 255.255.248.0" & @CRLF & _
" client-identifier 0194.c691.6a43.3f" & @CRLF & _
"!" & @CRLF & _
"ip dhcp pool Device3" & @CRLF & _
" host 10.10.10.250 255.255.248.0" & @CRLF & _
" client-identifier 0194.c691.fb53.7e" & @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