Skip to main content
Solved

How do I use Regex Alternation ( Pipe Symbol "|") in Parser Configuration

  • December 7, 2021
  • 1 reply
  • 194 views

Greetings,

 

How do use alternation when I use regex in Parser Configuration?

 

I want to find all standard and extendend ACLs:

regex[$acl]:^ip access-list extended|standard (\S+)

 

The below command works, but I am trying to get it to work with regex:

ip access-list $_dummy(extended|standard) $acl

 

Cheers


Dave

Best answer by dawal1337

I have found a workaround to my problem:

Method 1:

regex[$acl_type, $acl]:^ip access-list (extended|standard) (\S+)$

Creates 2 variables, one for ACL Type (Extended or Standard) and the ACL Name

 

Method 2:

regex[$acl_type, $acl]:^ip access-list \w+ (\S+)$

\w+ matches any alphanumeric string. Since there is only two types (standard and extended), this works too.

1 reply

  • Author
  • Inspiring
  • 9 replies
  • Answer
  • December 16, 2021

I have found a workaround to my problem:

Method 1:

regex[$acl_type, $acl]:^ip access-list (extended|standard) (\S+)$

Creates 2 variables, one for ACL Type (Extended or Standard) and the ACL Name

 

Method 2:

regex[$acl_type, $acl]:^ip access-list \w+ (\S+)$

\w+ matches any alphanumeric string. Since there is only two types (standard and extended), this works too.