Notepad++ help for fast formatting date of births
-
Hi everyone
i am trying to format date of births with double quotes
does anyone know a fast formula that can be used eg in Find and replace to add the double quotes quickly?
eg if i have the dates in format yyyy-mm-dd and I need to have a formula to mass add double quotes to a large volume of data
If we have a large number of rows of data and each item needs double quotes on it per each line of data
anyone come across any bulk formulas to achieve that?If anyone has any advice please let me know?
Thank you for anything you can share -
In regular expressions,
\dmeans “a digit” and{4}means “four of the previous token” (and similar), so FIND =\d{4}-\d{2}-\d{2}finds yyyy-mm-dd. In the replacement,$0will be replaced by the entire string from the FIND, so REPLACE ="$0"will put quotes around the yyyy-mm-dd string.You, of course, need to set Search Mode =
Regular expressionin order for it to use regular expressions.----
Useful References
-
@PeterJones said in Notepad++ help for fast formatting date of births:
\d{4}-\d{2}-\d{2}
thanks for your advice
i have to remove these unwanted " marks like in example below before the formula
199"0-"0"8-"28is there a way to add something to the formula you mention above to overcome this?
thanks -
@PeterJones
can you give us a formula when you have to remove quote marks from date births
before adding quote marks at each end of the date of birth
when it is format
yyyy-mm-ddexample I have the date of birth eg 199"2-"1"1-"12
and just want the double quote marks either side -
Don’t post essentially the same thing twice. The posting form reminds you that until you have enough upvotes, you have to wait for the posting queue for the post to show up.
If all of your badly-quoted dates have the quotes in exactly the same places (3 digits, quote, digit, hyphen, quote, digit, quote, digit, hyphen, quote, two digits), then you can use a similar idea to above, but put each into capture groups using the
(...)notation: FIND =(\d{3})"(\d)-"(\d)"(\d)-"(\d{2}). Each capture group gets numbered 1-5 for each set of parens, and is$1-$5in the REPLACE WITH field. So REPLACE WITH ="$1$2-$3$4-$5"
This will take199"0-"0"8-"28 199"2-"1"1-"12and make it
"1990-08-28" "1992-11-12"But I have a feeling you are going to tell me in the next post that what you really have is quotes in different places each time, like
1"99"0-"0"8-"28 199"2-"1"1-"12 "2"0"2"6"0"1"0"6"In which case, I’d say, look for “possible quote, digit, possible quote, digit, possible quote, …etc”, where “possible quote” is in regex as
"?(which means "0 or 1 quote mark)
FIND ="?(\d)"?(\d)"?(\d)"?(\d)"?-"?(\d)"?(\d)"?-"?(\d)"?(\d)"?
REPLACE ="$1$2$3$4-$5$6-$7$8"
REPLACE ALL
would give"1990-08-28" "1992-11-12" "2026-01-06"(Note that if you had more digits than that, like if you also had hh:mm:ss, so it would be up to 14, the replacements for 10-14 would be
${10}-${14})