Cisco Cisco Web Security Appliance S670 User Guide

Page of 606
 
17-24
Cisco IronPort AsyncOS 7.7 for Web User Guide
Chapter 17      URL Filters
Regular Expressions
In the following example, the regular expression matches files ending in 
.exe
.zip
, and .
bin
 in the 
downloads
 directory.
/downloads/.*\.(exe|zip|bin)
Avoid using regular expressions strings that are redundant because they can cause higher CPU usage on 
the Web Security appliance. A redundant regular expression is one that starts or ends with “.*”. 
Note
You must enclose regular expressions that contain blank spaces or non-alphanumeric characters in 
ASCII quotation marks.
Regular Expression Character Table
 describes characters that are commonly used to form regular expressions: 
Table 17-8
Regular Expression Character Descriptions 
Character
Description
.
Matches a single character.
*
Matches zero or more occurrences of the preceding regular expression. 
For example:
[0-9]* matches any number of digits
“.*” matches any arbitrary string of characters
^
Matches the beginning of a line as the first character of a regular expression.
$
Matches the end of a line as the last character of a regular expression.
+
Matches one or more occurrences of the preceding regular expression.
?
Matches zero or one occurrence of the preceding regular expression.
|
Matches the preceding regular expression or the following regular expression. For 
example:
x|y matches either x or y
abc|xyz matches either of the strings abc or xyz
[ ]
Matches the characters or digits that are enclosed within the brackets. 
For example:
[a-z] matches any character between a and z
[r-u] matches any of the characters r, s, t, or u
[0-3] matches any of the single digits 0, 1, 2, 3
{ }
Specifies the number of times to match the previous pattern. 
For example:
D{1,3} matches one to three occurrences of the letter D
( )
Group characters in a regular expression.
For example:
(abc)* matches abc or abcabcabc