From cb827cf3d6b7b07638c7518ed3ac90cbbc732a14 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 13 Dec 2017 19:42:15 +0100 Subject: [PATCH] Fix standard regular expressions to skip headers So we had an issue with the below output as it would repeat the headers as part of the returned values. The solution is to fix the regular expressions, as they would match too broad. For instance the expression `(\w+.\w+.\w+)` would match things like `A B C` or `Nightmare|On|ElmStreet`. Dots should be matched using `\.` and for a mac-address the regexp could be much more strict. Same for vlan numbers we know it's between 1 and 4 digits. --- templates/cisco_ios_show_mac-address-table.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/cisco_ios_show_mac-address-table.template b/templates/cisco_ios_show_mac-address-table.template index 0abb1ceec6..bfe3c05a42 100644 --- a/templates/cisco_ios_show_mac-address-table.template +++ b/templates/cisco_ios_show_mac-address-table.template @@ -1,6 +1,6 @@ -Value DESTINATION_ADDRESS (\w+.\w+.\w+) +Value DESTINATION_ADDRESS ([0-9a-f]{4}\.[0-9a-f]{4}\.[0-9a-f]{4}) Value TYPE (\w+) -Value VLAN (\w+) +Value VLAN (\d{1,4}) Value DESTINATION_PORT (\S+) Start @@ -20,4 +20,4 @@ TYPE3 TYPE4 ^\s+${VLAN}\s+${DESTINATION_ADDRESS}\s+${TYPE}\s+${DESTINATION_PORT} -> Record - +