Perl Regular Expression Formats - Fortinet FortiGate Series Administration Manual

Hide thumbs Also See for FortiGate Series:
Table of Contents

Advertisement

Email filtering
Word boundary
Case sensitivity

Perl regular expression formats

FortiGate Version 4.0 MR1 Administration Guide
01-410-89802-20090903
http://docs.fortinet.com/
Feedback
fortinet.com not only matches fortinet.com but also fortinetacom, fortinetbcom,
fortinetccom, and so on.
Note: To add a question mark (?) character to a regular expression from the FortiGate CLI,
enter Ctrl+V followed by ?. To add a single backslash character (\) to a regular expression
from the CLI you must add precede it with another backslash character. For example,
fortinet\\.com.
To match a special character such as '.' and '*' use the escape character '\'. For example:
To match fortinet.com, the regular expression should be: fortinet\.com
In Perl regular expressions, '*' means match 0 or more times of the character before it, not
0 or more times of any character. For example:
forti*.com matches fortiiii.com but does not match fortinet.com
To match any character 0 or more times, use '.*' where '.' means any character and the '*'
means 0 or more times. For example, the wildcard match pattern forti*.com should
therefore be fort.*\.com.
In Perl regular expressions, the pattern does not have an implicit word boundary. For
example, the regular expression "test" not only matches the word "test" but also any word
that contains "test" such as "atest", "mytest", "testimony", "atestb". The notation "\b"
specifies the word boundary. To match exactly the word "test", the expression should be
\btest\b.
Regular expression pattern matching is case sensitive in the web and Email Filter filters.
To make a word or phrase case insensitive, use the regular expression /i. For example,
/bad language/i will block all instances of "bad language", regardless of case.
Table 56
lists and describes some example Perl regular expression formats.
Using wildcards and Perl regular expressions
579

Advertisement

Table of Contents
loading

Table of Contents