#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)forward-zone:[.\s]*name:[\ ".\s]*forward"
Local $sString = "## Simple recursive caching DNS, UDP port 53" & @CRLF & _
"## unbound.conf -- https://calomel.org" & @CRLF & _
"#" & @CRLF & _
"server:" & @CRLF & _
" access-control: 10.0.0.0/8 allow" & @CRLF & _
" access-control: 127.0.0.0/8 allow" & @CRLF & _
" access-control: 192.168.0.0/16 allow" & @CRLF & _
" cache-max-ttl: 14400" & @CRLF & _
" cache-min-ttl: 900" & @CRLF & _
" hide-identity: yes" & @CRLF & _
" hide-version: yes" & @CRLF & _
" interface: 0.0.0.0" & @CRLF & _
" minimal-responses: yes" & @CRLF & _
" prefetch: yes" & @CRLF & _
" qname-minimisation: yes" & @CRLF & _
" rrset-roundrobin: yes" & @CRLF & _
" use-caps-for-id: yes" & @CRLF & _
" verbosity: 1" & @CRLF & _
"" & @CRLF & _
"forward-zone:" & @CRLF & _
" name: "."" & @CRLF & _
" forward-addr: 8.8.4.4 # Google" & @CRLF & _
" forward-addr: 8.8.8.8 # Google" & @CRLF & _
" forward-addr: 37.235.1.174 # FreeDNS" & @CRLF & _
" forward-addr: 37.235.1.177 # FreeDNS" & @CRLF & _
" forward-addr: 208.67.222.220 # OpenDNS" & @CRLF & _
" forward-addr: 208.67.222.222 # OpenDNS" & @CRLF & _
" forward-addr: 216.146.35.35 # Dyn Public" & @CRLF & _
" forward-addr: 216.146.36.36 # Dyn Public" & @CRLF & _
"" & @CRLF & _
"forward-zone:" & @CRLF & _
" name: "dns.com"" & @CRLF & _
" forward-addr: 50.116.23.211 # OpenNIC" & @CRLF & _
" forward-addr: 64.6.64.6 # Verisign" & @CRLF & _
" forward-addr: 64.6.65.6 # Verisign" & @CRLF & _
" forward-addr: 74.82.42.42 # Hurricane Electric" & @CRLF & _
" forward-addr: 84.200.69.80 # DNS Watch" & @CRLF & _
" forward-addr: 84.200.70.40 # DNS Watch" & @CRLF & _
" forward-addr: 91.239.100.100 # censurfridns.dk" & @CRLF & _
" forward-addr: 109.69.8.51 # puntCAT" & @CRLF & _
""
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH)
; 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