Regular expressions

Article:HOWTO82512  |  Created: 2012-11-30  |  Updated: 2014-06-25  |  Article URL
Article Type
How To


Regular expressions

You can combine alphanumeric characters and metacharacters to create match patterns for rules that will block messages and attachments specifically designed to bypass file filtering rules.

Table: Regular expressions lists examples of regular expressions that show how pattern matching is accomplished with the use of metacharacters and alphanumeric characters.

Table: Regular expressions

Regular expression



Matches any line of text that contains the three letters abc in that order.

Your results may differ depending on the comparison that you use to create the rule. For example, if you build a rule to match the word Free and use the Contains condition, then the filtering engine detects all words that contain the word Free instead of an exact match (for example, Freedom). However, if you use the Equal condition, then the filtering engine detects only exact matches of the word Free with no other surrounding text. If you use the Contains condition with Whole words only, then the filtering engine detects Free as a stand-alone word, even if there are other words present in the text that is being searched.


Matches any string that begins with the letter a, followed by any character, followed by the letter c.


Matches any line that contains exactly one character. (The newline character is not counted.)


Matches any string beginning with the letter a, followed by either zero or more instances of the letter b, or zero or more instances of the letter c, followed by the letter d.


Matches any file name that has two, three-letter extensions (for example, Filename.gif.exe).

This regular expression is helpful in blocking email attachments with double extensions. For example:

If Attachment Name + .+\....\....


Matches an embedded comment in the middle of meaningful HTML text. Embedding comments within HTML text is a trick that spam senders use to bypass some pattern-matching software.


Matches a white space character zero or more times.

See About regular expressions

See About DOS wildcard style expressions

Legacy ID


Article URL

Terms of use for this information are found in Legal Notices