Spam filter
Using Perl regular expressions
FortiGate-60M Administration Guide
01-28007-0144-20041217
339
Examples
To block any word in a phrase
/block|any|word/
To block purposely misspelled words
Spammers often insert other characters between the letters of a word to fool spam
blocking software.
/^.*v.*i.*a.*g.*r.*a.*$/i
/cr[eéèêë][\+\-\*=<>\.\,;!\?%&§@\^°\$£€\{\}()\[\]\|\\_01]dit/i
To block common spam phrases
The following phrases are some examples of common phrases found in spam
messages.
/try it for free/i
/student loans/i
/you’re already approved/i
/special[\+\-\*=<>\.\,;!\?%&~#§@\^°\$£€\{\}()\[\]\|\\_1]offer/i
[Aa]bc
either of Abc and abc
[abc]+
any (nonempty) string of a's, b's and c's (such as a, abba, acbabcacaa)
[^abc]+
any (nonempty) string which does not contain any of a, b and c (such as defg)
\
d\d
any two decimal digits, such as 42; same as \d{2}
/i
makes the pattern case insensitive. For example,
/bad language/i
blocks
any instance of
bad language
regardless of case.
\
w+
a “word”: a nonempty sequence of alphanumeric characters and low lines
(underscores), such as foo and 12bar8 and foo_1
100\s*mk
the strings 100 and mk optionally separated by any amount of white space
(spaces, tabs, newlines)
abc\b
abc when followed by a word boundary (e.g. in abc! but not in abcd)
perl\B
perl when not followed by a word boundary (e.g. in perlert but not in perl stuff)
\x
tells the regular expression parser to ignore white space that is neither
backslashed nor within a character class. You can use this to break up your
regular expression into (slightly) more readable parts.
/x
used to add regexps within other text. If the first character in a pattern is
forward slash '/', the '/' is treated as the delimiter. The pattern must contain a
second '/'. The pattern between ‘/’ will be taken as a regexp, and anything
after the second ‘/’ will be parsed as a list of regexp options ('i', 'x', etc). An
error occurs If the second '/' is missing. In regular expressions, the leading
and trailing space is treated as part of the regular expression.
Table 30: Perl regular expression formats
Summary of Contents for FortiGate FortiGate-60M
Page 12: ...Contents 12 01 28007 0144 20041217 Fortinet Inc Index 369 ...
Page 44: ...44 01 28007 0144 20041217 Fortinet Inc Changing the FortiGate firmware System status ...
Page 74: ...74 01 28007 0144 20041217 Fortinet Inc FortiGate IPv6 support System network ...
Page 82: ...82 01 28007 0144 20041217 Fortinet Inc Dynamic IP System DHCP ...
Page 116: ...116 01 28007 0144 20041217 Fortinet Inc Access profiles System administration ...
Page 234: ...234 01 28007 0144 20041217 Fortinet Inc Protection profile Firewall ...
Page 246: ...246 01 28007 0144 20041217 Fortinet Inc CLI configuration Users and authentication ...
Page 278: ...278 01 28007 0144 20041217 Fortinet Inc CLI configuration VPN ...
Page 340: ...340 01 28007 0144 20041217 Fortinet Inc Using Perl regular expressions Spam filter ...
Page 358: ...358 01 28007 0144 20041217 Fortinet Inc CLI configuration Log Report ...
Page 376: ...376 01 28007 0144 20041217 Fortinet Inc Index ...