Special
characte
r
Syntax Example
[xyz] Matches any single character in the
regular expression.
[123] matches the character 2 in
"255".
[^xyz] Matches any character that is not
contained within the brackets.
[^123] matches any character except
for "1", "2", and "3".
[a-z] Matches any character within the
specified range.
[0-9] matches any character ranging
from 0 to 9.
[^a-z] Matches any character beyond the
specified range.
[^0-9] matches all non-numeric
characters.
_ Matches a comma "," left brace "{",
right brace "}", left parenthesis "(",
and right parenthesis ")".
Matches the starting position of the
input string.
Matches the ending position of the
input string.
Matches a space.
_2008_ matches "2008", "space
2008 space", "space 2008", "2008
space", ",2008,", "{2008}",
"(2008)", "{2008)", and "(2008}".
NOTE
Unless otherwise specified, all characters in the preceding table are displayed on the screen.
l Degeneration of special characters
Certain special characters, when placed at certain positions in a regular expression,
degenerate to common characters.
– The special characters following "\" match special characters themselves.
– The special characters "*", "+", and "?" placed at the starting position of the regular
expression. For example, +45 matches "+45" and abc(*def) matches "abc*def".
– The special character "^" placed at any position except for the start of the regular
expression. For example, abc^ matches "abc^".
– The special character "$" placed at any position except for the end of the regular
expression. For example, 12$2 matches "12$2".
– A right parenthesis ")" or right bracket "]" is not paired with a corresponding left
parenthesis "(" or bracket "[". For example, abc) matches "abc)" and 0-9] matches
"0-9]".
NOTE
Unless otherwise specified, degeneration rules also apply when preceding regular expressions are
subexpressions within parentheses.
l Combinations of common and special characters
In actual usage, regular expressions combine multiple common and special characters to
match certain strings.
Huawei AR1200 Series Enterprise Routers
Configuration Guide - Basic Configuration 2 CLI Overview
Issue 04 (2012-05-15) Huawei Proprietary and Confidential
Copyright © Huawei Technologies Co., Ltd.
23