cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
601
Views
4
Helpful
3
Replies

LMS 4.0 Compliance Reg Expression Issue

xcz504d1114
Level 4
Level 4

I'm

having problems with a regexp, I'm trying to search for multiple patterns in the loopback description field:

Example:

Rtr1:

interface loopback0

description rndm:text:cursor:1536:blah:blah1

Rtr2:

interface loopback0

description rndm:text:cursor:3072:blah:blah1

The regular expression that works is:

+interface Loopback0

+ [#description .*:.*:.*:1536:.*#]

But that only searches for one instance, what I cannot get to work is the following:

+interface Loopback0

+ [#description .*:.*:.*:1536|3072:.*#]

I have tried many variants, but I cannot get the (pipe) to work properly.

Thanks in advance for any help,

Craig

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

Try:

+ [#description .*:.*:.*:(1536|3072):.*#]

Nope, still no luck, I did have to add \ in front of the

colons to get the specific location, the asteriks wwould allow it to search for that sting any

where in the description, but I couldn't get the pipe to work properly still, I've trie

d moving the hard brackets, paranthesis etc.

I ended up working around the problem, by creating individual lines:

+[#description .*\:.*\:.*\:1536\:.*\:.*\:.*#]

+[#description .*\:.*\:.*\:3072\:.*\:.*\:.*#]

+[#description .*\:.*\:.*\:2048\:.*\:.*\:.*#]

Then running the report, the report gave the output of which commands needed to be "added", so I used a seperate program to determine which devices were non-compliant, IE.

If router one needed all 3 of those commands, then I knew it did not match any of them, and was non-compliant, if router two only needed 2 of those commands, I knew that it was compliant.

Kind of a backwards approach, and I would still like to see the search work.

Thanks for the help,

Craig

The \ is not required as ':' is not a regular expression meta-character.  I tested with the parentheses and it's working for me.  What you want is certainly doable with one expression.  It seems like perhaps you didn't share the actual descriptions.  It may be helpful to see the actual config snippets to test more completely.

Review Cisco Networking for a $25 gift card