#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?mx)^(\d+)\R" & @CRLF & _
"[->\d: ,]+\R" & @CRLF & _
"((?:.+\R?)+)"
Local $sString = "3" & @CRLF & _
"00:01:40,200 --> 00:01:43,326" & @CRLF & _
"english part" & @CRLF & _
"" & @CRLF & _
"4" & @CRLF & _
"00:01:43,534 --> 00:01:44,851" & @CRLF & _
"خط فارسی" & @CRLF & _
"" & @CRLF & _
"5" & @CRLF & _
"00:01:45,063 --> 00:01:48,485" & @CRLF & _
"complex part مخلوط" & @CRLF & _
"" & @CRLF & _
"6" & @CRLF & _
"00:01:45,063 --> 00:01:48,485" & @CRLF & _
"complex part مخلوط" & @CRLF & _
"in 2 lines"
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