On 3/30/2011 3:53 PM, Ansgar Wiechers wrote:
On 2011-03-30 Corey Quinn wrote:
On Mar 30, 2011, at 12:46 PM, Noel Jones wrote:
# main.cf
smtp_generic_maps =
  regexp:/etc/postfix/generic.regexp

# generic.regexp
IF /+.*@example\.com$/
/^(.*)+/  [email protected]
ENDIF

Threw this verbatim into my generic.regexp:

[root@mx1 postfix]# postmap -q "[email protected]" regexp:generic.regexp
postmap: warning: regexp map generic.regexp, line 1: Invalid preceding regular 
expression
postmap: warning: regexp map generic.regexp, line 4: ignoring ENDIF without 
matching IF
[email protected]@example.com

On the plus side, I figured out how to do something interesting by
reading through the regexp documentation-- this solved another
challenge I'd been facing.

'+' has a special meaning in regular expressions (one or more times the
preceding term), so you need to escape it to match a literal '+':

if /\+.*@example\.com$/
/^(.*)\+/ [email protected]
endif

Regards
Ansgar Wiechers


that's what I get for posting an untested example and then walking away for a little while.

Escaping the "+" fixes the expression to what I intended.

Thanks everyone for cleaning up after me.

  -- Noel Jones

Reply via email to