#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)^([A-Z])(?=.*\r?\n-)"
Local $sString = "167" & @CRLF & _
"00:06:59,794 --> 00:07:01,379" & @CRLF & _
"Well, I would like to see" & @CRLF & _
"your face as soon as possible." & @CRLF & _
"" & @CRLF & _
"168" & @CRLF & _
"00:07:01,421 --> 00:07:03,048" & @CRLF & _
"Really?" & @CRLF & _
"- If that's possible, yeah." & @CRLF & _
"" & @CRLF & _
"169" & @CRLF & _
"00:07:03,089 --> 00:07:04,007" & @CRLF & _
"- Really?" & @CRLF & _
"- Mm-hmm." & @CRLF & _
"" & @CRLF & _
"170" & @CRLF & _
"00:07:04,049 --> 00:07:05,550" & @CRLF & _
"I wanna see your face." & @CRLF & _
"- Okay." & @CRLF & _
"" & @CRLF & _
"171" & @CRLF & _
"00:07:05,592 --> 00:07:07,427" & @CRLF & _
"Let's just order so we can get" & @CRLF & _
"the business out of the way,"
Local $sSubst = "- $1"
Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst)
MsgBox($MB_SYSTEMMODAL, "Result", $sResult)
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