RE: [Exim] Regex matching

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Bernard Stern
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: RE: [Exim] Regex matching
On Mon, 19 Mar 2001 07:31:08 -0500 "Tony Byers" wrote:

(...)

> ---- Philip Hazel <ph10@???> wrote:
>> On Fri, 16 Mar 2001, Tony Byers wrote:
>>
>> > I have a special director set up with a condition to only handle
>> mail
>> > with a hyphen in it. Here it is:
>> >
>> > special_director:
>> > condition = ${if match{$local_part}{.*-.*}{true}{false}}
>> > driver = forwardfile
>> > file = ${perl{getadds}}
>> > filter


why not simply use

local-parts = ^[^\\-]+\\-[^@]+

or

local-parts = ^[^\\-]*\\-[^@]*

if you really want to match localparts like 'blah-' or '-blah'.

>> >
>> > It doesn't match when I send something to x-y@???, but when I
>> run
>> > it through exim -be, this is the result:
>> >
>> > # exim -be
>> > > ${if match{x-y}{.*-.*}{true}{false}}
>> > true


what you may have missed here is that whatever goes between the
curly brackets is returned, in the case the string 'true', which
is probably not what you want.

there is also the nice little pcretest tool to test your
regexes. I use it a lot, saves plenty of debugging time.

(...)

Regards,

Bernard Stern, SWITCH

____________S_W_I_T_CH___Swiss Academic_______________________________________
        mail: SWITCH Head Office       a          Tel: +41 1 268 1520
              Limmatquai 138           n          Fax: +41 1 268 1568
              CH-8001 Zurich           d        e-mail: stern@???
________________________________________Reseach Network_______________________