[exim] Edge case - space separated list objects

Pàgina inicial
Delete this message
Reply to this message
Autor: Graeme Fowler
Data:  
A: exim users
Assumpte: [exim] Edge case - space separated list objects
Afternoon all

I'm trying to do some manipulation of the From: field display name section in order to do matching against a remote data source.

To do this, I want to take the name "Fred Bloggs" and turn that into "fredbloggs" and "bloggsfred". That bit is easy, using the sg operator with a match and the resulting $1, $2 item values.

The edge case is that for entities of three or more words (well, actually for the two word case too) I don't want to have to hard-code a set of ever-longer matches and assignments using $3, $4 etc - I'd like to be able to use something to do this dynamically using the map operator. For this I'm trying to use the ${listcount: expansion to give me the number of elements.

However... using a space separated list is proving to be a challenge. Bizarrely:

${listcount:Fred:Bloggs} == 2 (correct)
${listcount:Fred:J:Bloggs == 3 (correct)

yet:

${listcount:<" "Fred J Bloggs} == 2, because it's taking the first double quote as the separator.

Is there any way at all to specify a space separator for a list? I'm damned if I can work one out!

Yours in bafflement,

Graeme