I have file with multiple records:
for example:
"datetime": "2018-10-10"
"datetime": "2018-10-11"
"datetime": "2019-01-11"
"datetime": "2018-02-15"
I would like to replace this string such that i can retain the date values, so something of this sort:
"datetime": date("2018-10-10")
"datetime": date("2018-10-11")
"datetime": date("2019-01-11")
"datetime": date("2018-02-15")
I am able to use "datetime": ".*"
to find the above records, but am stuck with replacing them in the above format
help is appreciated
You may use
Find what: ("datetime": )(".*")
Replace with: \1date\(\2\)
Details
("datetime": )
- Group 1 (\1
in the replacement pattern): a literal "datetime":
substring
(".*")
- Group 2 (\2
in the replacement pattern): "
, any 0+ chars other than line break chars, as many as possible, and then a "
(note that in case your contents are mixed, it is much safer to use a non-greedy pattern here, ".*?"
)
Note that (
and )
inside the replacement pattern must be escaped as Notepad++ regex replacement patterns are Boost conditional replacement patterns and parentheses are "special" there.