#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)timeout\shttp-request\s+\d+(?=[\s\S]+defaults)"
Local $sString = "global" & @CRLF & _
" log 127.0.0.1 local0" & @CRLF & _
" log 127.0.0.1 local1 notice" & @CRLF & _
" #log loghost local0 info" & @CRLF & _
" maxconn 32768" & @CRLF & _
" tune.maxaccept -1" & @CRLF & _
" chroot /var/lib/haproxy" & @CRLF & _
" daemon" & @CRLF & _
" timeout http-request 5000" & @CRLF & _
" stats socket /var/run/haproxy.sock mode 600 level admin" & @CRLF & _
" stats timeout 2m" & @CRLF & _
"" & @CRLF & _
" " & @CRLF & _
"defaults" & @CRLF & _
" log global" & @CRLF & _
" mode http" & @CRLF & _
" option httplog" & @CRLF & _
" option dontlognull" & @CRLF & _
" retries 5" & @CRLF & _
" option redispatch" & @CRLF & _
" maxconn 16384" & @CRLF & _
" timeout connect 7s" & @CRLF & _
" timeout client 500s" & @CRLF & _
" timeout server 500s" & @CRLF & _
" timeout http-request 7000" & @CRLF & _
" timeout client-fin 30s" & @CRLF & _
" timeout tunnel 1h"
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