Example Regular Expressions - Fortinet Fortigate-5000 series Administration Manual

Hide thumbs Also See for Fortigate-5000 series:
Table of Contents

Advertisement

Antispam

Example regular expressions

FortiGate Version 3.0 MR4 Administration Guide
01-30004-0203-20070102
Table 42: Perl regular expression formats (Continued)
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 (for example, in "abc!" but not in
"abcd")
perl\B
"perl" when not followed by a word boundary (for example, in "perlert" but
not in "perl stuff")
\x
Tells the regular expression parser to ignore white space that is neither
preceded by a backslash character nor within a character class. Use this
to break up a regular expression into (slightly) more readable parts.
/x
Used to add regular expressions 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
regular expressions, and anything after the second '/' will be parsed as a
list of regular expression 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.
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.*o.*$/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
Using Perl regular expressions
395

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents