#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)DTS.?(HD|ES|X(?!\D))|TRUEHD|ATMOS|DD(\+|P).?([5-9])|EAC3.?([5-9])"
Local $sString = "#DTS matches" & @CRLF & _
"DTSHD" & @CRLF & _
"DTSES" & @CRLF & _
"DTSX5" & @CRLF & _
"DTS5HD" & @CRLF & _
"#DTS non-matches" & @CRLF & _
"DTSXXX" & @CRLF & _
"DTSA" & @CRLF & _
"" & @CRLF & _
"#these two are just exact matches" & @CRLF & _
"TRUEHD" & @CRLF & _
"ATMOS" & @CRLF & _
"#they are found anywhere in the text" & @CRLF & _
"ATMOSPHERE" & @CRLF & _
"" & @CRLF & _
"#DD matches" & @CRLF & _
"DD+5" & @CRLF & _
"DD+$5 #here $ is matched by .?" & @CRLF & _
"DD+45" & @CRLF & _
"DDP5" & @CRLF & _
"#DD non-matches" & @CRLF & _
"DD" & @CRLF & _
"DDA" & @CRLF & _
"DD+4" & @CRLF & _
"DDPx4" & @CRLF & _
"" & @CRLF & _
"#EAC matches" & @CRLF & _
"EAC345" & @CRLF & _
"EAC35" & @CRLF & _
"" & @CRLF & _
"#EAC non-matches" & @CRLF & _
"EAC34" & @CRLF & _
""
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