Regular expressions in commands, Example: permitting display commands only – H3C Technologies H3C Intelligent Management Center User Manual

Page 135

Advertising
background image

126

Metacharacters Meaning Examples

[a-z]

Matches a single character that is in
the range specified in the brackets.

"[c-x]" matches every lowercase letter in the range
of c to x.

[^a-z]

Matches a single character except the
ones in the range specified in the
brackets.

"[^c-x]" matches every letter except lowercase
letters in the range of c to x.

\b

Matches a word that starts with the
pattern following \b or ends with the

pattern preceding \b.

"er\b" matches "never", but not "verb".

\B

Matches a word that contains the
pattern but does not start or end with

the pattern.

"er\B" matches "verb", but not "never".

\D

Matches a non-digit, same as [^0-9]. N/A

\w

Same as [A-Za-z0-9_], matches a
digit, letter, or underscore.

N/A

\W

Same as [^A-Za-z0-9_], matches a
character that is not a digit, letter, or

underscore.

N/A

\

Escape character. If a special
character follows \, the specific

meaning of the character is removed.

"\^" matches a string containing "^". "\\b"
matches a string containing "\b".

Regular expressions in commands

TAM enables you to authorize commands that match a specific regular expression to device users.
The following information describes typical regular expression usages.

Example: Permitting display commands only

To configure a command set that permits only display commands, set the default authorization type to

Deny, and then add a command authorization rule that permits ^display.*$ commands.

Advertising