The regular expression match was learned due to the need for work. The data text exported from MongoDB is roughly the same:
{
"_id": ObjectId ("55370b4112db760740809f79"),
"Cartkey": {
"CustomerId": Numberlong (471)
},
"Lastupdate": Isodate ("2015-06-04t08:21:24.307z"),
"Baskets": [{
"Items": [{
"SKU": "5170",
"CategoryName": "Cables & Adapters"
}],
"CountryCode": 32
}]
}
{
"_id": ObjectId ("55769cc512db760da847d639"),
"Cartkey": {
"CustomerId": Numberlong (1002)
},
"Lastupdate": Isodate ("2015-06-01t00:00:00z"),
"Baskets": [{
"Items": [{
"SKU": "2716",
"CategoryName": "IPhone iPad IPod"
}],
"CountryCode": 46
}]
}
{
"_id": ObjectId ("54b5e9d412db761c388d6c48"),
"Cartkey": {
"CustomerId": Numberlong (4398734)
},
"Lastupdate": Isodate ("2015-06-05t03:49:11.131z"),
"Baskets": [{
"Items": [{
"SKU": "33883",
"CategoryName": "Plugs & Sockets"
}, {
"SKU": "126095",
"CategoryName": "Household thermometers"
}],
"CountryCode": 46
}]
}
The goal is to convert "CustomerId": Numberlong (4398734) to "CustomerId": 4398734, "lastupdate": Isodate ("2015-06-05t03:49:11.131z") Convert to "lastupdate": "2015-06-05t03:49:11.131z",
I'm using a regular replacement of the notepad++ editor.
The regular expression to find the target is: "CustomerId": numberlong\ ((. *) \)
To be replaced by: "CustomerId": \1
The date is: "Lastupdate": isodate\ ((. *) \)
Replace with "Lastupdate": \1
Why is \1? Because we all know the reason for using () is because of group.
Series Articles:
http://zhoufoxcn.blog.51cto.com/792419/281956/
Http://www.crifan.com/files/doc/docbook/rec_soft_npp/release/htmls/npp_func_regex_replace.html
Regular expression Matching