I have a string like 2005:10:29 12:23:53
and I wish to replace only first two occurrences of :
with -
Expected result 2005-10-29 12:23:53
EDIT:
I need this regexp in KDE's krename
tool, where I can't edit/format the original [exifExif.Image.DateTime]
witch returns the unwanted 2005:10:29 12:23:53
format, but there is a Find and Replace
to post process the String
(?<=\d{4}):|:(?=\d{2}\s)
does the job on rubular, but does not in KDE :(
I am sure there are more solutions.
EDIT:
:(?=\d{2}:\d{2}\s)|:(?=\d{2}\s)
works even on KDE
I find this solution after I read
You can use a full-fledged regular expression inside the lookahead.
Most regular expression engines only allow literal characters and
alternation inside lookbehind, since they cannot apply regular
expression backwards.