#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(?P<timestamp>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) (?P<level>INFO|ERROR|WARN|TRACE|DEBUG|FATAL)\s+\[(?P<firstSquareBrackets>[^\]]*)]\s+\[(?P<secondSquareBrackets>[^\]]*)]\s+\[(?P<thirdSquareBrackets>[^\]]*)]\s+\[(?P<fourthSquareBrackets>[^\]]*)]\s+\[(?P<fifthSquareBrackets>[^\]]*)] - (?P<textMessage>.*?)(?=\\Z|;\s+|\n)|(?P<exception>^.+Exception: .+)|(?P<stacktrace>^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
Local $sString = "2018-07-24 00:01:33,711 WARN [r3223r2r3] [] [] [ewqrwerwer] [ewfwefwef] - Failed;" & @CRLF & _
"2018-07-24 00:01:33,712 DEBUG [r3223r2r3] [] [] [ewqrwerwer] [ewfwefwef] - Sample log" & @CRLF & _
"2018-07-24 00:02:33,712 DEBUG [r3223r2r3] [] [] [ewqrwerwer] [ewfwefwef] - Sample log" & @CRLF & _
"2018-07-24 00:20:33,830 DEBUG [r3223r2r3] [] [] [ewqrwerwer] [ewfwefwef] - Sample log" & @CRLF & _
"2018-07-24 00:20:37,731 DEBUG [r3223r2r3] [] [] [3r2r32r] [c.i.s.h.r.i.RssNewsServiceImpl] - 3r232r" & @CRLF & _
"2018-07-24 10:33:45,852 ERROR [r3223r2r3] [fgd] [gr] [reger] [regre] - Sample log" & @CRLF & _
"javax.servlet.ServletException: Something bad happened" & @CRLF & _
" at com.example.myproject.OpenSessionInViewFilter.doFilter(OpenSessionInViewFilter.java:60)" & @CRLF & _
" at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)" & @CRLF & _
" at com.example.myproject.ExceptionHandlerFilter.doFilter(ExceptionHandlerFilter.java:28)" & @CRLF & _
" at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)" & @CRLF & _
" at com.example.myproject.OutputBufferFilter.doFilter(OutputBufferFilter.java:33)" & @CRLF & _
" at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)" & @CRLF & _
" at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)" & @CRLF & _
" at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)" & @CRLF & _
" at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)" & @CRLF & _
" at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)" & @CRLF & _
" at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)" & @CRLF & _
" at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)" & @CRLF & _
" at org.mortbay.jetty.Server.handle(Server.java:326)" & @CRLF & _
" at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)" & @CRLF & _
" at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)" & @CRLF & _
" at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)" & @CRLF & _
" at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)" & @CRLF & _
" at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)" & @CRLF & _
" at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)" & @CRLF & _
" at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)" & @CRLF & _
"Caused by: com.example.myproject.MyProjectServletException" & @CRLF & _
" at com.example.myproject.MyServlet.doPost(MyServlet.java:169)" & @CRLF & _
" at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)" & @CRLF & _
" at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)" & @CRLF & _
" at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)"
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