3

I didn't write the following regex, and I'm trying to figure out what it does. I know that it must begin with policy-map and must have at least one space between policy-map and whatever comes next. But I'm stuck trying to figure out what the stuff inside the parenthesis means. I know that whatever it is, it has to be at the end of the line.

^policy-map\\s+([\\x21-\\x7e]{1,40})$

Thanks!

BJ Dela Cruz
  • 4,986
  • 12
  • 47
  • 83

3 Answers3

13

characters in range from hex 21 to hex 7e (basically printable, non-whitespace ascii) 1 to 40 times.

Michael Krelin - hacker
  • 131,515
  • 23
  • 189
  • 171
8

^ begin of string

policy-map constant

\s+ spaces

([\x21-\x7e]{1,40}) 1-40 symbols from \x21 to \x7e (i.e. all printable, non-whitespace ASCII characters including punctuation, upper and lower case letters and numbers)

$ end of string

Mike Deck
  • 17,605
  • 16
  • 65
  • 92
burning_LEGION
  • 12,864
  • 8
  • 38
  • 50
7
^              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
MRAB
  • 19,740
  • 5
  • 38
  • 31