A useful data element to use when working Data Protection (DP) policies is the IP. You may have the need to restrict or register emails based on their origin. Or even create exclusions to policies based on IPs or IPs ranges. Currently DP doesn't offer a native IP condition, so we'll be using regex instead.
Our IP condition will be using regular expressions. In Email Security.cloud, DP regular expression engine supports Java 7 based expressions.
Important: When writing regular expressions, test the expressions to ensure that they works as you intend. Use the following pages to test your regular expressions:
\p{Punct}
Symantec recommends that you check the Oracle Summary of Regex Constructs for instructions on syntax. Ensure that you check the case insensitive option.
\b123\.123\.123\.123\b
0
and 99
, add the following before and after the IP: \b
0
and 25
, add the following before and after the IP: \b
(?:Your Comment Here)?
123.23.80.1
123\.23\.80\.1
. But because the 4th byte is between 0
and 25
, we need to add \b
, making it \b123\.23\.80\.1\b
. Otherwise it would match 123.23.80.1
, 123.23.80.10
to .19
, 123.23.80.100
to 123.23.80.199
, which isn't the desired result.\b123\.23\.80\.1\b(?:IP from ABC)?
195.168.1.0/23
^
and $
in the resulting expression with \b
. If you need to know the starting and ending of a given IP range you can use http://jodies.de/ipcalc.195.168.0.1
and the last IP Address: 195.168.1.254
of the range.^195\.168\.(0\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))|(([0-1])\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5])))|1\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4])))$
^ $
with \b
, so the expression we will use is (DO use this syntax):\b195\.168\.(0\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))|(([0-1])\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5])))|1\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4])))\b
\b195\.168\.(0\.([1-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))|(([0-1])\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5])))|1\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-4])))\b(?:IP Range from ABC)?