#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^config (dhcp|dns|router|interface) (?:ip|ipv4|id|bgp|name) (<[^>]*>|(?:\d+\.){3}\d+|[a-z]+ id \d+|\d+)( port| timeout| id|\s*)( <[^>]*>\s*| \d+\s*|\s*)$"
Local $sString = "config dhcp ip <dhcp-ipaddress> port <dhcp-port-number>" & @CRLF & _
"config dhcp ip <dhcp-ipaddress> timeout <time-out-value>" & @CRLF & _
"config dhcp ipv4 <dhcp-ipaddress>" & @CRLF & _
"config dns ip <dns-ipaddress> port <dns-port-number>" & @CRLF & _
"config dns ip <dns-ipaddress> timeout <time-out-value>" & @CRLF & _
"config router bgp <bgp-number>" & @CRLF & _
"config interface id <interface-id> " & @CRLF & _
"config interface name <interface-name> id <interface-id>" & @CRLF & _
"" & @CRLF & _
"config dhcp ip 1.1.1.1 port 8080" & @CRLF & _
"config dhcp ip 1.1.1.2 timeout 120" & @CRLF & _
"config dhcp ip 1.1.1.1 timeout 120" & @CRLF & _
"config dhcp ip 1.1.1.2 port 8080" & @CRLF & _
"config dhcp ipv4 1.1.1.3" & @CRLF & _
"config interface id 12 " & @CRLF & _
"config interface name abc id 12" & @CRLF & _
"config interface id 13 " & @CRLF & _
"config interface name xyz id 13" & @CRLF & _
"" & @CRLF & _
"config dhcp ip 1.1.1.1 port 8080" & @CRLF & _
"config dhcp ip 1.1.1.1 timeout 120" & @CRLF & _
"config dhcp ip 1.1.1.2 timeout 120" & @CRLF & _
"config dhcp ip 1.1.1.2 port 8080" & @CRLF & _
"config dhcp ipv4 1.1.1.3" & @CRLF & _
"config interface id 12 " & @CRLF & _
"config interface name abc id 12" & @CRLF & _
"config interface id 13 " & @CRLF & _
"config interface name xyz id 13"
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