View Single Post
Old 03-26-2024, 06:30 AM   #62
moldy
Enthusiast
moldy began at the beginning.
 
Posts: 38
Karma: 10
Join Date: Oct 2015
Device: Kindle
Thank you @lomkiri. The function, including the counters, works perfectly on my data file of 187 entries (and growing ever larger).

For my purposes I would have liked to have been able to add regex to the keys individually in the json file rather than globally in the line:
Code:
 m = regex.sub(rf'\b{key}\b(?![^<>]*>)', val, m)
This is in no way a criticism and the function is perfectly adequate for my needs as is.

Some of the entries in my data benefit from having the trailing '\b' removed while in others it causes errors. Some entries would be better with a little more regex added.

I can get round this by writing searches/replaces in a json with regex added and importing it into Saved Searches. Obviously this takes a little more time.
moldy is offline   Reply With Quote