On 10 Mar 2012, at 6:58 PM, Marc Perkel wrote:
> How would I create a Regex expression to capture mime filenames like this?
>
> \321\320~\267\242.\266\340~\317\356.\304\277\241\244\271\334.\300\355862277.xls
This "^((?:\\\d+[~.]?)+\.xls)$" works for me in Perl and in Python, since Exim uses PCRE regexes it should work in exim too
Python:
import re
x=r'\321\320~\267\242.\266\340~\317\356.\304\277\241\244\271\334.\300\355862277.xls'
m=re.match(r'^((?:\\\d+[~.]?)+\.xls)$', x)
Perl:
my $s = '\321\320~\267\242.\266\340~\317\356.\304\277\241\244\271\334.\300\355862277.xls';
if ($s =~ m|^((?:\\\d+[~.]?)+\.xls)$|){
print "$1\n";
}
--
www.baruwa.org