View Single Post
Old 09-20-2024, 07:44 PM   #715
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,012
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
On the inverse: How do I define a regex?

Since has_extra_files() is a bit slow, I'm adding the count to my admintags column with a template that:

1. Use a regex to match and remove any existing extra_files entries.
2. Generate a new extra_files entry.
3. Remove any entries matching 'extra_files:' exactly (zero files).

However, the regex on line 6 is failing to match:

Code:
program:

#to be replaced with $#admintags
tags = 'extra_files:123, blahblah';

old_tag = 'extra_files:\d+';
filecount = strcat('extra_files:', has_extra_files());

clean_tags = list_difference(tags, old_tag, ',');
new_tags = list_union(filecount, clean_tags, ',');

nonzero = list_difference(new_tags, 'extra_files:', ',')
I also tried strcat('extra_files:', '(\d+)');

Last edited by ownedbycats; 09-20-2024 at 07:47 PM.
ownedbycats is offline   Reply With Quote