Other examples, with and without colons:-
If FileExists("in.txt") = 0 Then FileWrite("in.txt", _
"ejkhfjkhf:jkhdkjhdkjhdedi77d38g239dg9g9" & @CRLF & _
"jefdhwejkhfwef8h:wejifhwejhwef" & @CRLF & _
"wehdfwejh:ewfg287gf8723gf" & @CRLF & _
"323rRfef3:f39f78g39fg93f:Lfui23hf2L23fu2hfui2f:32fih" & @CRLF & _
"234df1ds:du19hd912398dh8dh")
ConsoleWrite("------ jchd without colon.-------" & @LF)
;FileWrite("out.txt", StringRegExpReplace(FileRead("in.txt"), "(?m)^([^:]*?)(:.*)$", "$1")) ; jchd without colon.
ConsoleWrite(StringRegExpReplace(FileRead("in.txt"), "(?m)^([^:]*?)(:.*)$", "$1") & @LF) ; jchd without colon.
ConsoleWrite("------ Results with colon.-------" & @LF)
ConsoleWrite(StringRegExpReplace(FileRead("in.txt"), "([^:]*?:).*", "$1") & @LF) ; Results with colon.
ConsoleWrite("------ Results without colon.-----" & @LF)
ConsoleWrite(StringRegExpReplace(FileRead("in.txt"), "(:.*)", "") & @LF) ; Without colon, results same as jchd's.
FileDelete("in.txt")
#cs
------ jchd without colon.-------
ejkhfjkhf
jefdhwejkhfwef8h
wehdfwejh
323rRfef3
234df1ds
------ Results with colon.-------
ejkhfjkhf:
jefdhwejkhfwef8h:
wehdfwejh:
323rRfef3:
234df1ds:
------ Results without colon.-----
ejkhfjkhf
jefdhwejkhfwef8h
wehdfwejh
323rRfef3
234df1ds
#ce