[exim] String expansion - deleting everything but a specifie…

Top Page
Delete this message
Reply to this message
Author: Marcin Krol
Date:  
To: exim-users
Subject: [exim] String expansion - deleting everything but a specified set of characters from string
Hello everyone,

I'd like to use maildir_tag containing subject of mail in transport, but with characters undesirable in filename converted to underscores.

I configured the following and it works:

maildir_tag = T=${sg{${from_utf8:$acl_m_subject}}{\N[!@#$%^&*()~ {}\]\]\|"'`;\:/\?<>,\.]\N}{_}}-S=$message_size

...but it looks terrible, it's error prone and some characters might still slip through instead being converted to underscores as intended.

I suspect some ${sg magic might work, along the lines:

${sg{$acl_m_subject}{\N([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)([a-zA-Z0-9]+)\N}{\$1\$2\$3\$4}}

But this is not much better really.


--
Marcin Krol