04-19-2021 06:39 AM - edited 04-19-2021 06:47 AM
Hi,
REGULAR EXPRESSION, a filtring tool based on ::
Special characters, Characters classes, Sets, Groups, Flags.
are all these ASPECTS availible in cisco iOS, iOS XE ?
is there other unknown characters like underscore "_" ?
Best Regards!
04-19-2021 08:36 AM - edited 04-19-2021 08:36 AM
Hello,
yes regular expressions are available in IOS, IOS XE and IOS XR and NX-OS.
There are two main applications for regular expresssion in IOS:
a) Filtering BGP advertisements using regular expressions applied to the AS path attribute seen as a sequence of characters
see
b) using regular expressions in show commands to filter show output.
Hope to help
Giuseppe
04-20-2021 06:29 AM - edited 04-20-2021 07:08 AM
Hi,
i'm using regex to filter show commands this time !. it works almost fine, just for some cases ::
* the digits specification \d does not work
* how to escape characters \.
* how to use ?=non-greedy as it is considered as help on cisco iOS
* is it possible to provide an underscore "_" exemples !
best regards!
04-20-2021 10:13 AM - edited 04-20-2021 10:14 AM
Hello,
in order to make the regex to search for a special character "literally" the character has to have a \ before
show ip int br | inc gigabitethernet0/0/0\.*
should show all subinterfaces of gigabitethernet0/0/0.
This trick should work also for '_' underscore to match it literally try to use \_
Hope to help
Giuseppe
04-19-2021 03:34 PM
Please be very, very careful when dealing with IOS-XE and REGEX, particularly the "pipe". This is due to CSCvo06817.
04-20-2021 06:32 AM
Hi,
using grep after the terminal shell command, does is offer more advantages or it's the same as |Pipe include ...
best regards!
04-20-2021 03:47 PM
"grep" option only works for Nexus OS. The bug I've pointed out is for IOS-XE.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide