[exim] Re: Exim filter get number before the dot

Top Page
Delete this message
Reply to this message
Author: Evgeniy Berdnikov
Date:  
To: exim-users
Subject: [exim] Re: Exim filter get number before the dot
On Sat, Sep 09, 2023 at 10:43:54PM +0100, Jeremy Harris via Exim-users wrote:
> >
> > $h_X-Spam-Potential:{{^(\\d+).*\$}{\$1}} is above 16
>
> That's written to be ambiguous, even with the questionable
> dounbled backslash (compare with your original):


Doubling of backslash, as well as "\$" is necessary because ${sg..}
expands all of its arguments, and this behaviour is documented with
proper examples.

It's really ambiguous, because ".*" may contain digits, but default
PCRE behaviour is preference of leading pattern in expansion loop.
I do not remember how this "greediness" may be changed (one should
study docs), but this variant works:

# exim4 -be '${sg{16}{^(\\d+).*\$}{\$1}}'
16
exim4 -be '${sg{16.45}{^(\\d+).*\$}{\$1}}'
16
--
Eugene Berdnikov

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@???
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/