A regular expression is a combination of characters or character classes and operators that describe text for matching purposes. Regular expressions are like wildcards, only more powerful. With Email Gateway Defense or the Barracuda Email Security Gateway, for example, you can use regular expressions in many of its block/allow features.
Note: Matches are not case-sensitive. All regular expressions are lowercase before use as is the text against which expressions are matched. For this reason, you cannot use capital letter character classes.
Operators recognized in regular expressions include:
|*||zero or more times|
|+||one or more times|
|?||zero or one time|
A character class matches a character or range of characters listed between brackets '[' and ']'. Use a dash '-' to specify a range of characters. Use the '^' character inside the brackets '[' and ']' to negate a class. Some examples are:
|any character except newline|
one of the following characters: a A c C
anything but the characters 'a', 'A', 'c', 'C'
|letters 'a' through 'z' regardless of case|
|letters 'a' through 'z' or 'A' through 'Z' or a dot|
|any alphabetic character or a dash|
digit, shortcut for [0-9]
|part of word: shortcut for [A-Za-z0-9_]|
|space character: shortcut for [ \n\r\t]|
|beginning of line|
|end of line|
The following characters have a special meaning in regular expressions on Barracuda Email Gateway Defense and are prepended by a backslash '\' character when they are interpreted literally:
matches cialis, but not specialist
|p[^\w]?h[^\w]?a[^\w]?r[^\w]?m[^\w]?a[^\w]?c[^\w]?y||matches pha,rmacy or P.harm-acy|
matches viagra, VIAGRA or vIaGRa
matches 1 or more digits: 0, 42, 007
|(bad|good)||matches the letters 'bad' or matches the letters 'good'|
|^free||matches the letters 'free' at the beginning of a line|
matches viagra or v1agra
|v(ia|1a)gra||matches viagRA or v1agra|
|v\|agra||matches v|Agra, V|Agra, v|agRa, etc.|
|v(i|1|\|)?agra||matches vagra, viaGra, v1agrA, V|AGRA, etc.|
matches *FREE*, *frEE*, etc.
|\*FREE\* V.*GRA||matches *FREE* VIAGRA, *Free* VEHiCLegrA, etc.|