#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox
Local $sRegex = "(\d\d\d\d)-(\d\d)(-\d\d\D)?"
Local $sString = "ABC 2012-10-01" & @CRLF & _
"DEF 2013-07-10" & @CRLF & _
"2018-01-21" & @CRLF & _
"ABG 2015-10-30A" & @CRLF & _
"EDF 2019-01-19B" & @CRLF & _
"ABC/DEF/GEH 2019-01-19A" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
""
Local $sSubst = ""
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