#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?xs) ^(?P<timestamp>\d{4}/\d{2}/\d{2}\ \d{2}:\d{2}:\d{2})" & @CRLF & _
" \ \[(?P<severity>emerg|alert|crit|error|warn|notice|info)\]" & @CRLF & _
" \ (?P<process_id>\d+)" & @CRLF & _
" \#(?P<thread_id>\d+):" & @CRLF & _
" \ \*(?P<connection_id>\d+)" & @CRLF & _
" \ (?P<error>.+?)" & @CRLF & _
" (?:\ while\ (?P<context>.+?))?" & @CRLF & _
" ,\ client:\ (?P<client_ip>\d+\.\d+\.\d+\.\d+)" & @CRLF & _
" ,\ server:\ (?P<server>.+?)" & @CRLF & _
" (?:,\ request:\ \"(?P<request_method>[A-Z]+?)" & @CRLF & _
" \ (?P<request_path>\/.+?)" & @CRLF & _
" \ (?P<request_protocol>.+?)\")?" & @CRLF & _
" (?:,\ upstream:\ \"(?P<upstream>.+?)\")?" & @CRLF & _
" (?:,\ host:\ \"(?P<host>.+?)\")?" & @CRLF & _
" (?:,\ referrer:\ \"(?P<referrer>.+?)\")?" & @CRLF & _
" $"
Local $sString = "2019/07/11 07:19:30 [error] 934#934: *18897816 open() "/local/nginx/static/ads.txt" failed (2: No such file or directory), client: 85.195.82.90, server: app.digitale-sammlungen.de, request: "GET /ads.txt HTTP/1.1", host: "app.digitale-sammlungen.de""
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