I'm trying to do some regex matching in the Junos CLI, like show configuration | match "fancy.pants(reg|ex)". I especially want to look for word boundaries and other character classes. I'm used to \b, \d, etc. in PCRE-ish regex, and that doesn't work.

According to Juniper's docs:

Juniper Networks uses the regular expressions as defined in POSIX 1003.2.

For the life of me, I cannot find any documentation of the actual 1003.2 standard. I have found a thousand pages explaining regex flavors, but none seem complete or authoritative.
They lead me to understand that POSIX 1003.2 defines Basic and Extended Regular Expressions (BRE & ERE). From experimentation, it seems that the Junos CLI respects at least some Extended features.

So does Junos CLI matching use ERE specifically?
And is there an official standard to reference?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Dec 25 '18 at 9:01

This is a draft I have found of the standard (1003.2), see pages 128 onwards


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.