Subject Regular Expressions Syntax

The Subject Regular Expression field allows you to enter values in the Python Regular Expressions (RE) syntax.

For example, to create a DLP policy rule to find emails that contains the string [secure] in the email subject, add (?i)\[secure] or \[secure] where (?i) is used to specify that it is case insensitive to the Subject Regular Expression field in the policy.

To create a DLP policy rule to find emails that contain either the exact strings [secure] or [encrypt] in the email subject, you can add either \[secure\]|\[encrypt\] or ex \[secure]|\[encrypt] to the Subject Regular Expression field in the policy.

For more information, see Python regular expressions documentation.

The symbols for the start (^) and end ($) of a line are not supported. See Unsupported Regex Patterns in DLP.

To create a DLP policy rule that detects emails containing the exact word sec in the email body (but not words like Security or Seconds), regardless of whether it's at the beginning of a sentence or separated by spaces or tabs, you can use the boundary marker \b. For example, use \bsec\b.

Unsupported Regex Patterns in DLP

When creating a DLP rule using regular expressions (regex), the following patterns are not supported.

  • Regular expressions with a length shorter than three characters are not supported.

  • The system also blocks the following regex patterns, as they may cause inefficient or inaccurate matching:

    [
    ".",
    ".*",
    ".+",
    ".?",
    ".{0,}",
    ".*?",
    ".+?",
    "[\s\S]",
    "[\s\S]+",
    "[\w\W]",
    "[\w\W]+",
    "\s*",
    "\S*",
    "\w*",
    "\W*",
    "\d*",
    "\D*",
    "\s+",
    "\S+",
    "\w+",
    "\W+",
    "\d+",
    "\D+",
    ]