Replacing timestamps in Notepad++
17,688
You can use this expression:
\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}
As suggested by @slhck, one can use \d
to replace [0-9]
, thus reducing the expression.
Having difficulties reading the expression:
\d
-> any digit from 0 to 9.
{4}
-> four chars count.
\d{4}
will search for four numbers.
Repeating this to mach the desired date format, adding the relevant separators like: -
, :
and , we've got an expression for this problem.
Related videos on Youtube
Author by
slhck
Updated on September 18, 2022Comments
-
slhck almost 2 years
I have a log file with time stamps on each line such as
2012-06-26 21:31:40 Killshot: Something, Something... 2012-06-26 21:31:40 Killed [player name] 2012-06-26 21:31:40 Executing Death Sequence 2012-06-26 21:31:41 Restarting match
I want to replace all the timestamps with blank space in N++. How would I go about having it replace all the different timestamps with that blank space?
-
slhck almost 12 yearsYou can just use
\d
for a digit instead of[0-9]
. -
Zuul almost 12 years@slhck Tks, updated!