I am struggling to figure out how to replace date format in notepad++ I have a key which contain different dates.
<pk2>2014/01/03</pk2>
Should be changed to:
<pk2>2014-01-03</pk2>
and so on.
Any suggestion on how to do this?
I am struggling to figure out how to replace date format in notepad++ I have a key which contain different dates.
<pk2>2014/01/03</pk2>
Should be changed to:
<pk2>2014-01-03</pk2>
and so on.
Any suggestion on how to do this?
This will replace / with - only inside tag <pk2>...</pk2>.
Tell me if you want to replace other dates.
(?:<pk2>|\G(?!^))\d+\K/(?=.*</pk2)-. matches newlineExplanation:
(?: # non capture group
<pk2> # opening tag pk2
| # OR
\G(?!^) # restart from last match position if not beginning of line
) # end group
\d+ # 1 or more digits
\K # forget all we have seen until this position
/ # a slash
(?= # positive lookahead, make sure we have after:
.* # 0 or more any character but newline
</pk2 # closing tag
) # end lookahead
Screenshot (before):
Screenshot (after):