Using Regular Expressions for Conditional Rules in Mail Security for Domino

Article:TECH171943  |  Created: 2011-10-17  |  Updated: 2013-10-22  |  Article URL http://www.symantec.com/docs/TECH171943
Article Type
Technical Solution


Subject

Issue



This article describes how to create Content Filtering (CF) rules using Regular Expressions in Symantec Mail Security for Domino (SMSDOM) or Symantec Mail Security for Domino Multi Platform Edition (SMSDOM-MPE) version 8.x.


Solution



Creating a Content Filtering (CF) rule using Regular Expressions
SMSDOM_Settings > Edit > Content_Filtering > New Rule > Apply Rule Conditionally

When creating a CF rule to be applied conditionally, the values for ‘Users/Groups/Internet Domains’ can be specified in regular expression format.

Example: 
If the value for the attribute "Any Recipient" is: admin.*Symantec.*
the CF rule will match the following recipient addresses:

  • admin@Symantec.com
  • admin_xyz@Symantec.com
  • admin/Symantec
  • “abc” admin_user@Symantec.com
  • admin@Symantec.co.in
  • and others....

 

For domains, it is recommended to use only the domain names and not the whole email address.

Example:
If the value for the attribute "Any Recipients Domain" is: symantec.* 
the CF rule will match any email address with the main domain part containing "symantec".


Notes:

  • When an "IF" condition is set, the rule is violated only for the matching values, that is: 
    if the recipient name is entered in the "if" condition, then the rule will be violated only if the message is sent to that specific address. For other recipients the rule will be ignored.
    Also note: if there are more than one recipients and one of them matches the condition, then the rule will be violated.
  • Similarly to when an "UNLESS" condition is set, the rule is applied for all the other values except for the matching ones, that is: 
    if the recipient name is entered in the "unless" condition, then the rule will be violated for all the other recipients except for the matching address.
    Also note: if there are multiple recipients and one of them matches the condition, then the rule is NOT applied.
  • For domain field use only the domain names & not the whole email address.
  • The attributes ‘Every Recipient’ and ‘Every Recipients Domain’ will return the following boolean results:
    • TRUE for IF conditions (rule is always applied).
    • FALSE for UNLESS conditions (rule is always ignored). 
       

 

Additional reference on the ICU Regular Expression Operators

  1. Any character matches itself, not anything else. 
    For example, “a” matches “a” only, these are called literals.
  2. All characters are literal except  *, ? , and \ .
  3. “*” matches zero or more any characters.
  4. “?” matches any character one time, except literal period character (“.”).
  5. “\x” matches “x” itself, where “x” is any character.

 

The following table is taken from http://userguide.icu-project.org/strings/regexp

Operator Description
| Alternation. A|B matches either A or B.
* Match 0 or more times. Match as many times as possible.
+ Match 1 or more times. Match as many times as possible.
? Match zero or one times. Prefer one.
{N.EN_US} Match exactly n times
{n,} Match at least n times. Match as many times as possible.
{n,m} Match between n and m times. Match as many times as possible, but not more than m.
*? Match 0 or more times. Match as few times as possible.
+? Match 1 or more times. Match as few times as possible.
?? Match zero or one times. Prefer zero.
{N.EN_US}? Match exactly n times
{n,}? Match at least n times, but no more than required for an overall pattern match
{n,m}? Match between n and m times. Match as few times as possible, but not less than n.
*+ Match 0 or more times. Match as many times as possible when first encountered, do not retry with fewer even if overall match fails (Possessive Match)
++ Match 1 or more times. Possessive match.
?+ Match zero or one times. Possessive match.
{N.EN_US}+ Match exactly n times
{n,}+ Match at least n times. Possessive Match.
{n,m}+ Match between n and m times. Possessive Match.
( ... ) Capturing parentheses. Range of input that matched the parenthesized subexpression is available after the match.
(?: ... ) Non-capturing parentheses. Groups the included pattern, but does not provide capturing of matching text. Somewhat more efficient than capturing parentheses.
(?> ... ) Atomic-match parentheses. First match of the parenthesized subexpression is the only one tried; if it does not lead to an overall pattern match, back up the search for a match to a position before the "(?>"
(?# ... ) Free-format comment (?# comment ).
(?= ... ) Look-ahead assertion. True if the parenthesized pattern matches at the current input position, but does not advance the input position. 
(?! ... ) Negative look-ahead assertion. True if the parenthesized pattern does not match at the current input position. Does not advance the input position. 
(?<= ... ) Look-behind assertion. True if the parenthesized pattern matches text preceding the current input position, with the last character of the match being the input character just before the current position. Does not alter the input position. The length of possible strings matched by the look-behind pattern must not be unbounded (no * or + operators.) 
(?<! ... ) Negative Look-behind assertion. True if the parenthesized pattern does not match text preceding the current input position, with the last character of the match being the input character just before the current position. Does not alter the input position. The length of possible strings matched by the look-behind pattern must not be unbounded (no * or + operators.) 
(?ismwx-ismwx: ... ) Flag settings. Evaluate the parenthesized expression with the specified flags enabled or -disabled. 
(?ismwx-ismwx) Flag settings. Change the flag settings. Changes apply to the portion of the pattern following the setting. For example, (?i) changes to a case insensitive match. 




Article URL http://www.symantec.com/docs/TECH171943


Terms of use for this information are found in Legal Notices