#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?is)Diagnostic-Code:\s+?(.*)"
Local $sString = "Diagnostic-Code: smtp; 550-5.1.1 The email account that you tried to reach does" & @CRLF & _
" not exist. Please try 550-5.1.1 double-checking the recipient's email" & @CRLF & _
" address for typos or 550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1" & @CRLF & _
" https://support.google.com/mail/?p=NoSuchUser 63si4621095ybi.465 - gsmtp"
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