Cisco Systems IPS 7.1 Home Security System User Manual


  Open as PDF
of 1042
 
1-9
Cisco Intrusion Prevention System CLI Sensor Configuration Guide for IPS 7.1
OL-19892-01
Chapter 1 Introducing the CLI Configuration Guide
Regular Expression Syntax
The following examples demonstrate the special characters:
a* matches any number of occurrences of the letter a, including none.
a+ requires that at least one letter a be in the string to be matched.
ba?b matches the string bb or bab.
\** matches any number of asterisks (*).
To use multipliers with multiple-character patterns, you enclose the pattern in parentheses.
(ab)* matches any number of the multiple-character string ab.
([A-Za-z][0-9])+ matches one or more instances of alphanumeric pairs, but not none (that is, an
empty string is not a match).
The order for matches using multipliers (*, +, or ?) is to put the longest construct first. Nested constructs
are matched from outside to inside. Concatenated constructs are matched beginning at the left side of the
construct. Thus, the regular expression matches A9b3, but not 9Ab3 because the letters are specified
before the numbers.
You can also use parentheses around a single- or multiple-character pattern to instruct the software to
remember a pattern for use elsewhere in the regular expression.
To create a regular expression that recalls a previous pattern, you use parentheses to indicate memory of
a specific pattern and a backslash (\) followed by a digit to reuse the remembered pattern. The digit
specifies the occurrence of a parentheses in the regular expression pattern. If you have more than one
remembered pattern in your regular expression, \1 indicates the first remembered pattern, and \2
indicates the second remembered pattern, and so on.
The following regular expression uses parentheses for recall:
a(.)bc(.)\1\2 matches an a followed by any character, followed by bc followed by any character,
followed by the first any character again, followed by the second any character again.
For example, the regular expression can match aZbcTZT. The software remembers that the first
character is Z and the second character is T and then uses Z and T again later in the regular
expression.
[] Enclosing a set of characters indicates that any of the enclosed characters may match
the target character.
\ Allows specifying a character that would otherwise be interpreted as special.
\xHH represents the character whose value is the same as the value represented by
(HH) hexadecimal digits [0-9A-Fa-f]. The value must be non-zero.
BEL is the same as \x07, BS is \x08, FF is \x0C, LF is \x0A, CR is \x0D, TAB is \x09,
and VT is \x0B.
For any other character ‘c’, ‘\c’ is the same as ‘c’ except that it is never interpreted as
special
Table 1-2 Regular Expression Syntax (continued)
Character Description