On Wed, Mar 20, 2024 at 01:42:16PM +0100, Ralf Hildebrandt via Postfix-users
wrote:
> Hi!
>
> I wonder if this is possible:
>
> If a PCRE/regexp style map is triggering, it can be quite hard to
> find out WHICH pattern actually caused the action.
>
> So maybe postmap (when invoked with "-b", "-h" or "-q key") could emit
> which regular expression (or which line it was in) actually matched.
>
> Yes, I could give all my regular expressions patterns a unique RHS or
> find the regular expressions by divide-et-impera, but I'm being lazy.
With bash <(command) inline file syntax, make the RHS unique on the fly:
$ keystr=...
$ remap=/etc/postfix/...
$ postmap -q "$keystr" pcre:<(perl -pe 's/$/ LINE $./ unless
m{^(if|endif|#)?\s}' "$remap")
Better yet, don't be lazy, include a fingerprint string in your RHS
reject rule values.
--
Viktor.
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]