#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(?m)\s* \s*"
Local $sString = "18:30" & @CRLF & _
"18:20" & @CRLF & _
"17:30" & @CRLF & _
"18:30" & @CRLF & _
"17:58" & @CRLF & _
"18:00" & @CRLF & _
"19:00 18:41" & @CRLF & _
"18:00" & @CRLF & _
"19:00" & @CRLF & _
"18:12 19:00 21:00" & @CRLF & _
"20:11 20:00 21:00" & @CRLF & _
"20:56" & @CRLF & _
"21:00 22:00 21:33"
Local $sSubst = "$0\n"
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