Hello.
 
On Fri, Dec 19, 2025 at 02:59:18PM -0600, Johnnie Adams via Exim-users wrote:
> Thanks! Here's the new result for a bracketed period:

[ trace skipped]

> As you can see, the escaped periods give a faulty result, while the
> bracketed period gives the right result and panics the application.
> Neither of those states is ideal.

 No. Skipped trace shows that
 
 1. Bracketed period "[.]list" regular expression is NOT used, because
    outer lookup fails, and its failure is programmed to eject "fail"
    exception.

 2. Escaped period "\.list" is successfully compiled to RE=".list" and
    successfully applied to the string "johnnies-test-list-2.list", making
    two substitutions: first "-list" is removed, then ".list" is removed.
    This is because dot (.) in RE is interpreted as "any character".
    Resulting string after ${sg..} is "johnnies-test-2", as it should be.

 Manual says:

 ${sg{<subject>}{<regex>}{<replacement>}}
    This item works like Perl’s substitution operator (s) with the
    global (/g) option; hence its name.

 Perl's "global" (/g) means "repeated use over whole string, single pass".
 So two matches occur, leading to two substitutions.

 Note that RE=".list" is not identical to RE="[.]list", because first
 means "any character followed by string 'list'", and second means
 "dot character followed by string 'list'" (same as RE="\.list").
 This is how regex engine works. You can play with "exim -be" to test it:

 exim -be -d-all+expand '${sg{aa..bb}{\.}{c}}'
 
 exim -be -d-all+expand '${sg{aa..bb}{[.]}{c}}'
 exim -be -d-all+expand '${sg{aa..bb}{\\\.}{c}}'
-- 
 Eugene Berdnikov

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

Reply via email to