|  05-21-2022, 03:26 PM | #1 | 
| Evangelist            Posts: 498 Karma: 32554 Join Date: May 2014 Location: Canada Device: Kobo Sage | 
				
				Help with S&R RegEx Function
			 
			
			I recently lost all my saved searches (my own fault) and while I have recovered them from a backup, there were a few tweaks I did that I can't for the life of me remember how I did them. There is one, in particular, I hope to get help with. I currently have three different "Last Read" versions on my ebooks/fics: 
 Here is the "Find" I have recovered from my backup, which I can get to work for the 2nd & 3rd versions above: Code: (<em>N/A</em>| \d{1,2}/\d{2}/\d{4})Code: def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    from datetime import datetime
    return datetime.now().strftime(" %m/%d/%Y")Can anyone help? (I *might* have set up a separate S&R for that one, but I'm 98% positive I didn't.) | 
|   |   | 
|  05-22-2022, 05:02 PM | #2 | |
| Member    Posts: 13 Karma: 280 Join Date: Aug 2017 Device: touch lux | Quote: 
 | |
|   |   | 
| Advert | |
|  | 
|  05-22-2022, 05:30 PM | #3 | 
| Evangelist            Posts: 498 Karma: 32554 Join Date: May 2014 Location: Canada Device: Kobo Sage | 
			
			No, I tried that and it didn't work (I did go through that thread.) First, that was only for N/A, and I can't get it to work with the tags. With the tags, I can get #2 and #3 to work, but don't remember how I modified it for #1 Thank you though. | 
|   |   | 
|  05-23-2022, 04:02 PM | #4 | |
| Member    Posts: 13 Karma: 280 Join Date: Aug 2017 Device: touch lux | Quote: 
 Code: Last Read:</b>\K(<em>N/A</em>| \d{1,2}/\d{2}/\d{4}|\s)Explanation : You have to specify the text before the targeted text ("Last Read:</b>"), because you don't want to capture all spaces in the page  . The \K reinitialize the pointer at this position (i.e. "forget the text found until this point") | |
|   |   | 
|  05-25-2022, 10:12 AM | #5 | 
| Evangelist            Posts: 498 Karma: 32554 Join Date: May 2014 Location: Canada Device: Kobo Sage | 
			
			Thank you, I'm not home for the rest of the week, but I will try when I get back
		 | 
|   |   | 
| Advert | |
|  | 
|  05-29-2022, 02:23 AM | #6 | 
| Evangelist            Posts: 498 Karma: 32554 Join Date: May 2014 Location: Canada Device: Kobo Sage | 
			
			Ok, that one worked! Thank you. I was sure I had tried that, but with all the variations I tried, I probably missed a few. Again thank you so much! | 
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Help creating possible Regex-Function | MerlinMama | Editor | 14 | 03-03-2020 05:53 AM | 
| Predefined regex for Regex-function | sherman | Editor | 3 | 01-19-2020 05:32 AM | 
| regex function replacement | The_book | Sigil | 5 | 12-09-2019 09:45 AM | 
| Random number in Regex Function? | nqk | Editor | 2 | 05-23-2017 11:47 PM | 
| Regex Function about «» and “” | senhal | Editor | 8 | 04-06-2016 02:12 AM |