[exim] Regexp match on a header

Top Page

Reply to this message
Author: Ian Zimmerman
Date:  
To: exim-users
Subject: [exim] Regexp match on a header
I am trying to pick out the IP addresses from Received headers in the
DATA ACL. For now, only for logging, and to start I just want the first
one. Here is what I tried:

acl_check_data:

# Log the Received line IPs from upstream MTAs.

  warn
        set acl_m_data_rip = ${if match {$bh_received:}{\N[[](\d+[.]\d+[.]\d+[.]\d+)[]]} $1 {}}


  warn
        condition = $acl_m_data_rip
        logwrite = IP address from Received header is $acl_m_data_rip


And this was the result:

temporarily rejected after DATA: failed to expand ACL string \
"${if match {$bh_received:}{\N[[](\d+[.]\d+[.]\d+[.]\d+)[]]} $1 {}}": missing } at end of string

The braces are balanced, so why is a closing one "missing"?

--
Please *no* private Cc: on mailing lists and newsgroups
Personal signed mail: please _encrypt_ and sign
Don't clear-text sign: http://cr.yp.to/smtp/8bitmime.html