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
  • 5,194
  • 13
  • 51
  • 84

3 Answers3

13

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

Michael Krelin - hacker
  • 138,757
  • 24
  • 193
  • 173
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
  • 18,045
  • 16
  • 68
  • 92
burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
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
  • 20,356
  • 6
  • 40
  • 33