View Single Post
Old 08-03-2023, 03:16 PM   #2
MerlinMama
Evangelist
MerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beauty
 
MerlinMama's Avatar
 
Posts: 498
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Sage
After fiddling around, I managed to get something workable. I would still like to know, if possible, why what I had stopped working so suddenly. I had set up the regex-function over a year ago in a basic form, but about 6 or so months ago, I changed the format on my cover page and added the '</dt><dd>' part only.

I had to remove '\K' from the find, and I changed the regex-function part to:

Spoiler:
Code:
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    from datetime import datetime
    return 'Last Read:</b></dt><dd>' + datetime.now().strftime(" %m/%d/%Y")

**I added the underline here to show what I added, it is not in the actual regex-function**

If there is a better way to accomplish this, any suggestions are welcome!
MerlinMama is offline   Reply With Quote