The -s says to return the substring actually matched in the expression along with
the key, the two separated from each other by a $| operator. Now, observe this mini configuration
file in rule-testing mode:
% /usr/sbin/sendmail -bt -Cdemo.cf
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
23.7 Alphabetized Database-Map Types | 935
> test bob
test input: bob
test returns: bob $| bob
> test alice
test input: alice
test returns: alice
By adding a -a switch, which appends text to the matched key:
Kmatch regex -s -a.FOUND (bob|ted)
we see that the matched key with -s is second:
> test bob
test input: bob
test returns: bob $| bob . FOUND
When multiple substrings can be matched, the -s database switchcan be used to specify
which substring match to return. Consider:
Kmatch regex -s2 -a.FOUND (\|\)@(\|\)
There are two substring searches here, first the (\|\) choice and then the (\
|\) choice. Because the -s has a 2 as its argument, the second matched substring will
be returned, not the first:
> test a@bob
test input: a @ bob
test returns: bob . FOUND
In more complex expressions, it might be desirable to return multiple substrings.
Pages:
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653