#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)(^\d+\n)(^([01][0-9]|2[0-3]):([0-5]\d):[0-5]\d,\d{3}\s-->\s([01][0-9]|2[0-3]):([0-5]\d):[0-5]\d,\d{3}\n).*"
Local $sString = "640" & @CRLF & _
"00:41:10,510 --> 00:41:12,888" & @CRLF & _
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." & @CRLF & _
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. " & @CRLF & _
"" & @CRLF & _
"641" & @CRLF & _
"00:41:15,849 --> 00:41:17,267" & @CRLF & _
"Por cierto, me llamo Hughie." & @CRLF & _
"Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur." & @CRLF & _
"" & @CRLF & _
"642" & @CRLF & _
"00:41:18,185 --> 00:41:19,186" & @CRLF & _
"Annie." & @CRLF & _
"Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." & @CRLF & _
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
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