bug-mailfromd
Re: [Bug-mailfromd] attachment filtering / removal
Marc <Marc@xxxxxxxxxxxxxxxxx> ha escrit:
> Currently I just have a loop testing for 20+ file types/extensions,
You needn't iterate over them, just pack them all in one regular
expression instead, e.g.:
mime_match_filename(current_message(), '\.((exe)|(zip)|(png))$')
To automate maintaining such a regexp, use emacs regexp-opt function, or
this Perl module:
https://metacpan.org/pod/List::Regexp
E.g. running
regexp-opt zip exe bz2 xz xls pdf png
produces
(bz2|exe|p(df|ng)|x(ls|z)|zip)
Regards,
Sergey