#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(zzdel\s+)(from\s+)([^\.]+)\.([^\s]+\s)([^\s]+)\n(INNER\s+)(JOIN\s+)([^\.]+)\.(T001\s+)(t0\s+)(on\s+)(t0\.mandt\s+)(=\s+)([^\.]+)\.(mandt\s+)"
Local $sString = "from SPP01.AUFM t" & @CRLF & _
"" & @CRLF & _
"'' zzdel" & @CRLF & _
"from LP101.AFRU afru" & @CRLF & _
"INNER JOIN SPP01.T001 t0 on t0.mandt = t.mandt" & @CRLF & _
"INNER JOIN SPP01.BSEG on x=y" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"from LP101.AFRU afru" & @CRLF & _
"INNER JOIN SPP01.T001 t0 on t0.mandt = t.mandt" & @CRLF & _
"" & @CRLF & _
"INNER JOIN SPP01.T001 t0 on t0.mandt=t.mandt" & @CRLF & _
"INNER JOIN SPP01.T001 t0 on t0.mandt = t.mandt" & @CRLF & _
"" & @CRLF & _
"(zzdel\s+)" & @CRLF & _
"(from\s+)([^\.]+)\.([^\s]+\s)([^\s]+)" & @CRLF & _
"(INNER\s+)(JOIN\s+)([^\.]+)\.(T001\s+)(t0\s+)(on\s+)(t0\.mandt\s+)(=\s+)([^\.]+)\.(mandt\s+)" & @CRLF & _
"" & @CRLF & _
"(INNER\s+)(JOIN\s+)([^\.]+)\.([^\.]+)(on\s)([^\.]+)(=)([^\s]+)" & @CRLF & _
"\1\2\.\3\4\nINNER JOIN \2\.T001 t0 on t0\.mandt =\4\.mandt"
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