我没有写下面的正则表达式,现在我正在尝试弄清它是做什么用的。我知道它必须以policy-map开头,并且policy-map后面必须至少有一个空格。但我卡在了括号里面的东西是什么意思上。我知道无论它是什么,都必须在行末。
^policy-map\\s+([\\x21-\\x7e]{1,40})$
谢谢!
字符范围为十六进制21到七十六(基本上是可打印的、非空格ASCII)重复1到40次。
[\\x21-\\x7e]
通常用于描述字母数字和特殊字符。 - Hans Z^
字符串开始
policy-map
常量
\s+
空格
([\x21-\x7e]{1,40})
从\x21到\x7e的1-40个字符(即所有可打印的、非空白ASCII字符,包括标点、大写和小写字母和数字)
$
字符串结束
^ Start of string
policy-map "policy-map"
\\s+ One or more whitespace characters
( Start of capture group 1
[\\x21-\\x7e] From 1 to 40 characters in the range '\x21' to '\7E'
) End of capture group 1
$ End of string