21-8
Cisco Security Appliance Command Line Configuration Guide
OL-12172-03
Chapter 21 Using Modular Policy Framework
Configuring Special Actions for Application Inspections
To test and create a regular expression, perform the following steps:
Step 1
To test a regular expression to make sure it matches what you think it will match, enter the following
command:
hostname(config)#
test
regex
input_text regular_expression
Where the
input_text
argument is a string you want to match using the regular expression, up to 201
characters in length.
The
regular_expression
argument can be up to 100 characters in length.
Use
Ctrl+V
to escape all of the special characters in the CLI. For example, to enter a tab in the input
text in the
test regex
command, you must enter
test regex "test[Ctrl+V Tab]" "test\t"
.
If the regular expression matches the input text, you see the following message:
INFO: Regular expression match succeeded.
If the regular expression does not match the input text, you see the following message:
INFO: Regular expression match failed.
Step 2
To add a regular expression after you tested it, enter the following command:
[
a
-
c
]
Character range class
Matches any character in the range.
[a-z]
matches any
lowercase letter. You can mix characters and ranges:
[abcq-z]
matches a, b, c, q, r, s, t, u, v, w, x, y, z, and so
does [
a-cq-z]
.
The dash (-) character is literal only if it is the last or the
first character within the brackets:
[abc-]
or
[-abc]
.
""
Quotation marks
Preserves trailing or leading spaces in the string. For
example,
" test"
preserves the leading space when it
looks for a match.
^
Caret
Specifies the beginning of a line.
\
Escape character
When used with a metacharacter, matches a literal
character. For example,
\[
matches the left square
bracket.
char
Character
When character is not a metacharacter, matches the
literal character.
\r
Carriage return
Matches a carriage return 0x0d.
\n
Newline
Matches a new line 0x0a.
\t
Tab
Matches a tab 0x09.
\f
Formfeed
Matches a form feed 0x0c.
\x
NN
Escaped hexadecimal number
Matches an ASCII character using hexadecimal (exactly
two digits).
\
NNN
Escaped octal number
Matches an ASCII character as octal (exactly three
digits). For example, the character 040 represents a
space.
Table 21-1
regex Metacharacters (continued)
Character Description
Notes
Summary of Contents for 500 Series
Page 38: ...Contents xxxviii Cisco Security Appliance Command Line Configuration Guide OL 12172 03 ...
Page 45: ...P A R T 1 Getting Started and General Information ...
Page 46: ......
Page 277: ...P A R T 2 Configuring the Firewall ...
Page 278: ......
Page 561: ...P A R T 3 Configuring VPN ...
Page 562: ......
Page 891: ...P A R T 4 System Administration ...
Page 892: ......
Page 975: ...P A R T 5 Reference ...
Page 976: ......