View Single Post
Old 02-06-2023, 02:48 AM   #8004
culytera
Zealot
culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.
 
Posts: 135
Karma: 295674
Join Date: Jul 2021
Device: iPhone
Quote:
Originally Posted by JimmXinu View Post
Only if you can do it with regexp. There's probably a way, but I don't know it off hand.
I think I figured it out! So far this works. I also have a custom column for the exact word count with the type integers and format {:,d} so I can sort the list on Calibre by the word count taken from AO3.
Code:
add_to_extra_valid_entries:,prefix_wordcount
include_in_prefix_wordcount:numWords

replace_metadata:
 prefix_wordcount=>^(\d+|([0-4],\d{3})*)$=>[w] <5000
 prefix_wordcount=>^(([5-9],\d{3})*|10,000)$=>[w] 5000-10000
 prefix_wordcount=>^((?!10,000)(1\d,\d{3})*|20,000)$=>[w] 10001-20000
 prefix_wordcount=>^((?!20,000)([2-4]\d,\d{3})*|50,000)$=>[w] 20001-50000
 prefix_wordcount=>^((?!50,000)(([5-9]\d)|(\d{3,}))(,\d{3})+)$=>[w] 50000+

include_subject_tags:prefix_wordcount
It should return [w] 5000, [w] 5000-10000, etc. as tags. The comma is used as a delimiter by Calibre for tags so I didn't put one. Too bad 5000-10000 isn't sorted on the tag list properly unless I put a zero before it, but that looks weird to me.
culytera is offline   Reply With Quote