Thread: Text to Date
View Single Post
Old 02-09-2018, 08:42 PM   #4
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by ilovejedd View Post
I don't think named groups work with bulk metadata s&r. I just do it that way because I can get cross-eyed when editing regex.
The search and replace uses the Python regex. Named groups do work in the replace string.
Quote:
Tried \3 \4 \2 (#custom to last_modified) and it didn't work. Note, I have all my dates set to MMM dd yyyy in Tweaks.
What does "didn't work" mean? Nothing happened, the date wasn't what you expected, or there was an error? If there was an error, then what was it? Some detail in what went wrong and what you tried makes it a lot easier to suggest a fix.

For me it is working. For the replacement string, I would recommend:

Code:
\2-\3-\4
or:

Code:
\g<year>-\g<month>-\g<day>
That is the least ambiguous format for a date. And as that is the date you are using in the comment, the following is what I would have used:

Code:
.*(Completed|Updated): (.+?) .*
Or maybe:

Code:
*(Completed|Updated): ([\d-]+).*
with the replace as simply "\2".
davidfor is offline   Reply With Quote